List of usage examples for android.net Uri withAppendedPath
public static Uri withAppendedPath(Uri baseUri, String pathSegment)
From source file:com.chale22.ico01.iconfragment.IconFragmentGames.java
@Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { String icon = adapterView.getItemAtPosition(i).toString(); Intent result = new Intent(null, Uri.withAppendedPath(CONTENT_URI, icon)); setResult(RESULT_OK, result);/*from www . ja v a 2 s .com*/ finish(); }
From source file:com.appdynamics.demo.gasp.service.AsyncRESTClient.java
public void getIndex(int index) { AsyncRestCall restCall = new AsyncRestCall() { @Override/* www. jav a 2 s . co m*/ protected void onPostExecute(String results) { mListener.onCompleted(results); } }; restCall.setRestUri(Uri.withAppendedPath(mBaseUri, String.valueOf(index))); restCall.execute(); }
From source file:org.noorganization.instalistsynch.controller.local.dba.impl.ClientLogDbController.java
@Override public Date getLeastRecentUpdateTimeForUuid(String _clientUuid) { Cursor cursor = mContentResolver.query(Uri.withAppendedPath(InstalistProvider.BASE_CONTENT_URI, "log"), LogInfo.COLUMN.ALL_COLUMNS, LogInfo.COLUMN.ITEM_UUID + " LIKE ? ", new String[] { _clientUuid }, LogInfo.COLUMN.ACTION_DATE + " DESC "); if (cursor == null) { return null; }/*ww w . j ava 2s. c om*/ if (cursor.getCount() == 0) { cursor.close(); return null; } cursor.moveToFirst(); String date = cursor.getString(cursor.getColumnIndex(LogInfo.COLUMN.ACTION_DATE)); try { return ISO8601Utils.parse(date, new ParsePosition(0)); } catch (ParseException e) { e.printStackTrace(); return null; } finally { cursor.close(); } }
From source file:com.hybris.mobile.lib.b2b.loader.ProductLoader.java
@Override public Uri getUri() { return Uri.withAppendedPath(CatalogContract.Provider.getUriDataDetails( mContentServiceHelper.getConfiguration().getCatalogAuthority()), mQueryProduct.getCode()); }
From source file:org.jraf.android.dcn.handheld.app.addressinfo.list.AddressInfoLoader.java
private static AddressInfo getAddressInfoFromCursor(Cursor cursor) { Uri structuredPostalUri = ContentUris.withAppendedId(ContactsContract.Data.CONTENT_URI, cursor.getLong(2)); AddressInfo addressInfo;//from ww w .j ava 2 s . c o m try { addressInfo = AddressInfo.parseAugmented(cursor.getString(3)); } catch (ParseException e) { Log.w("Ignoring StructuredPostal " + structuredPostalUri, e); return null; } addressInfo.uri = structuredPostalUri; addressInfo.contactInfo.uri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, cursor.getLong(0)); addressInfo.contactInfo.contentLookupUri = Uri .withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, cursor.getString(4)); addressInfo.contactInfo.displayName = cursor.getString(1); return addressInfo; }
From source file:org.onebusaway.android.report.ui.SimpleArrivalListFragment.java
public static void show(AppCompatActivity activity, Integer containerViewId, ObaStop stop, Callback callback) { FragmentManager fm = activity.getSupportFragmentManager(); SimpleArrivalListFragment fragment = new SimpleArrivalListFragment(); fragment.setObaStop(stop);/*w w w.ja v a 2s .com*/ Intent intent = new Intent(activity, SimpleArrivalListFragment.class); intent.setData(Uri.withAppendedPath(ObaContract.Stops.CONTENT_URI, stop.getId())); fragment.setArguments(FragmentUtils.getIntentArgs(intent)); fragment.setCallback(callback); try { FragmentTransaction ft = fm.beginTransaction(); ft.replace(containerViewId, fragment, TAG); ft.addToBackStack(null); ft.commit(); } catch (IllegalStateException e) { Log.e(TAG, "Cannot show SimpleArrivalListFragment after onSaveInstanceState has been called"); } }
From source file:net.kourlas.voipms_sms.Utils.java
/** * Gets a URI pointing to a contact's photo, given a phone number. * * @param applicationContext The application context. * @param phoneNumber The phone number of the contact. * @return a URI pointing to the contact's photo. *//*w ww .java 2 s .co m*/ public static String getContactPhotoUri(Context applicationContext, String phoneNumber) { Uri uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(phoneNumber)); return getContactPhotoUri(applicationContext, uri); }
From source file:com.mindprotectionkit.freephone.contacts.ContactAccessor.java
public CursorLoader getPeopleCursor(Context context, String filter) { Uri uri = Uri.withAppendedPath(Phone.CONTENT_FILTER_URI, Uri.encode(filter)); return getPeopleCursor(context, uri); }
From source file:com.innoc.secureline.contacts.ContactAccessor.java
public CursorLoader getRegisteredContactsCursor(Context context, String filter) { Uri uri = Uri.withAppendedPath(Phone.CONTENT_FILTER_URI, Uri.encode(filter)); return getRegisteredContactsCursor(context, uri); }
From source file:com.caju.uheer.app.services.infrastructure.ContactablesLoaderCallbacks.java
@Override public Loader<Cursor> onCreateLoader(int loaderIndex, Bundle args) { String query = ""; JSONArray nearbyUsers = new JSONArray(); Uri uri = Uri.withAppendedPath(CommonDataKinds.Contactables.CONTENT_FILTER_URI, query); // Sort results such that rows for the same contact stay together. String sortBy = CommonDataKinds.Contactables.LOOKUP_KEY; CursorLoader cursorLoader = new CursorLoader(mContext, // Context uri, // URI representing the table/resource to be queried null, // projection - the list of columns to return. Null means "all" null, // selection - Which rows to return (condition rows must match) null, // selection args - can be provided separately and subbed into selection. sortBy); // string specifying sort order try {/*from w w w .j ava 2 s . com*/ // Parsing the JSON received from server. String nearbyUsersString = args.getString("jsonString"); nearbyUsers = new JSONObject(nearbyUsersString).getJSONArray("nearbyUsers"); } catch (JSONException e) { e.printStackTrace(); } for (int i = 0; i < nearbyUsers.length(); i++) { // Log.d("json", "" + nearbyUsers.getJSONObject(0).get("email")); try { query = nearbyUsers.getJSONObject(i).getString("email"); } catch (JSONException e) { e.printStackTrace(); } // query = args.getString("query"); uri = Uri.withAppendedPath(CommonDataKinds.Contactables.CONTENT_FILTER_URI, query); cursorLoader = new CursorLoader(mContext, // Context uri, // URI representing the table/resource to be queried null, // projection - the list of columns to return. Null means "all" null, // selection - Which rows to return (condition rows must match) null, // selection args - can be provided separately and subbed into selection. sortBy); // string specifying sort order Cursor cursor = cursorLoader.loadInBackground(); Toast.makeText(mContext, "entrei no cursorLoader", Toast.LENGTH_LONG).show(); if (cursor.getCount() == 0) { return cursorLoader; } int nameColumnIndex = cursor.getColumnIndex(CommonDataKinds.Contactables.DISPLAY_NAME); int lookupColumnIndex = cursor.getColumnIndex(CommonDataKinds.Contactables.LOOKUP_KEY); cursor.moveToFirst(); String lookupKey = ""; String displayName = ""; do { String currentLookupKey = cursor.getString(lookupColumnIndex); if (!lookupKey.equals(currentLookupKey)) { displayName = cursor.getString(nameColumnIndex); lookupKey = currentLookupKey; } } while (cursor.moveToNext()); Toast.makeText(mContext, displayName, Toast.LENGTH_LONG).show(); try { JSONObject jobj = new JSONObject().put("name", displayName); if (!nearbyUsers.getJSONObject(i).has("channel")) { double[] geoPoint = new double[2]; geoPoint[0] = nearbyUsers.getJSONObject(i).getJSONObject("geoPoint").getDouble("latitude"); geoPoint[1] = nearbyUsers.getJSONObject(i).getJSONObject("geoPoint").getDouble("longitude"); jobj.put("lat", geoPoint[0]); jobj.put("lon", geoPoint[1]); } else { String channel = nearbyUsers.getJSONObject(i).getString("channel"); jobj.put("channel", channel); } usersFound.put(jobj); } catch (JSONException e) { e.printStackTrace(); } } return cursorLoader; }