Tabnine Logo
ContentUris
Code IndexAdd Tabnine to your IDE (free)

How to use
ContentUris
in
android.content

Best Java code snippets using android.content.ContentUris (Showing top 20 results out of 2,268)

origin: udacity/ud851-Exercises

  /**
   * This method creates a {@link Uri} for a single term, referenced by id.
   * @param id The id of the term.
   * @return The Uri with the appended id.
   */
  public static Uri buildTermUriWithId(long id) {
    return ContentUris.withAppendedId(CONTENT_URI, id);
  }
}
origin: robolectric/robolectric

@Test(expected = UnsupportedOperationException.class)
public void parseIdThrowsUnsupportedException() {
 ContentUris.parseId(Uri.parse("mailto:bar@foo.com"));
}
origin: curtis2/SuperVideoPlayer

result = mProvider.insert(tableUri, values);
if (result != null) {
 rowId = ContentUris.parseId(result);
 entry.mRowId = rowId;
result = ContentUris.withAppendedId(tableUri, rowId);
mProvider.update(result, values, null, null);
origin: WangDaYeeeeee/GeometricWeather

  static PendingIntent getCalendarPendingIntent(Context context, int requestCode) {
    Uri.Builder builder = CalendarContract.CONTENT_URI.buildUpon();
    builder.appendPath("time");
    ContentUris.appendId(builder, System.currentTimeMillis());
    return PendingIntent.getActivity(
        context,
        requestCode,
        new Intent(Intent.ACTION_VIEW).setData(builder.build()),
        PendingIntent.FLAG_UPDATE_CURRENT);
  }
}
origin: geniusgithub/AndroidDialer

@Nullable
private Cursor getCallLogInfoCursor(Uri voicemailUri) {
  return mResolver.query(
      ContentUris.withAppendedId(CallLog.Calls.CONTENT_URI_WITH_VOICEMAIL,
          ContentUris.parseId(voicemailUri)),
      CallLogQuery._PROJECTION, null, null, null);
}
origin: plusonelabs/calendar-widget

static Intent createOpenCalendarAtDayIntent(DateTime goToTime) {
  Intent intent = createCalendarIntent();
  Uri.Builder builder = CalendarContract.CONTENT_URI.buildUpon();
  builder.appendPath(TIME);
  if (goToTime.getMillis() != 0) {
    intent.putExtra(KEY_DETAIL_VIEW, true);
    ContentUris.appendId(builder, goToTime.getMillis());
  }
  intent.setData(builder.build());
  return intent;
}
origin: udacity/ud851-Exercises

  /**
   * This method creates a {@link Uri} for a single term, referenced by id.
   * @param id The id of the term.
   * @return The Uri with the appended id.
   */
  public static Uri buildTermUriWithId(long id) {
    return ContentUris.withAppendedId(CONTENT_URI, id);
  }
}
origin: jokermonn/permissions4m

Uri rawContactUri = contentResolver.insert(ContactsContract.RawContacts
    .CONTENT_URI, values);
long rawContactId = ContentUris.parseId(rawContactUri);
values.put(ContactsContract.Contacts.Data.MIMETYPE, ContactsContract.CommonDataKinds
    .StructuredName.CONTENT_ITEM_TYPE);
origin: plusonelabs/calendar-widget

private List<CalendarEvent> getPastEventsWithColorList() {
  Uri.Builder builder = Instances.CONTENT_URI.buildUpon();
  ContentUris.appendId(builder, 0);
  ContentUris.appendId(builder, DateUtil.now(zone).getMillis());
  List<CalendarEvent> eventList = queryList(builder.build(), getPastEventsWithColorSelection());
  for (CalendarEvent event : eventList) {
    event.setDefaultCalendarColor();
  }
  return eventList;
}
origin: udacity/ud851-Exercises

  /**
   * This method creates a {@link Uri} for a single term, referenced by id.
   * @param id The id of the term.
   * @return The Uri with the appended id.
   */
  public static Uri buildTermUriWithId(long id) {
    return ContentUris.withAppendedId(CONTENT_URI, id);
  }
}
origin: robolectric/robolectric

@Test public void canParseId() {
 assertThat(ContentUris.parseId(Uri.withAppendedPath(URI, "1"))).isEqualTo(1L);
 assertThat(ContentUris.parseId(URI)).isEqualTo(-1L);
}
origin: udacity/ud851-Exercises

  /**
   * This method creates a {@link Uri} for a single term, referenced by id.
   * @param id The id of the term.
   * @return The Uri with the appended id.
   */
  public static Uri buildTermUriWithId(long id) {
    return ContentUris.withAppendedId(CONTENT_URI, id);
  }
}
origin: robolectric/robolectric

@Test(expected = NumberFormatException.class)
public void parseIdThrowsNumberFormatException() {
 ContentUris.parseId(Uri.withAppendedPath(URI, "bar"));
}
origin: udacity/ud851-Exercises

  /**
   * This method creates a {@link Uri} for a single term, referenced by id.
   * @param id The id of the term.
   * @return The Uri with the appended id.
   */
  public static Uri buildTermUriWithId(long id) {
    return ContentUris.withAppendedId(CONTENT_URI, id);
  }
}
origin: jgilfelt/chuck

@Override
@Nullable
public Cursor query(@NonNull Uri uri, @Nullable String[] projection,
          @Nullable String selection, @Nullable String[] selectionArgs,
          @Nullable String sortOrder) {
  SQLiteDatabase db = databaseHelper.getWritableDatabase();
  Cursor cursor = null;
  switch (matcher.match(uri)) {
    case TRANSACTIONS:
      cursor = LocalCupboard.getInstance().withDatabase(db).query(HttpTransaction.class).
          withProjection(projection).
          withSelection(selection, selectionArgs).
          orderBy(sortOrder).
          getCursor();
      break;
    case TRANSACTION:
      cursor = LocalCupboard.getInstance().withDatabase(db).query(HttpTransaction.class).
          byId(ContentUris.parseId(uri)).
          getCursor();
      break;
  }
  if (cursor != null) {
    cursor.setNotificationUri(getContext().getContentResolver(), uri);
  }
  return cursor;
}
origin: udacity/ud851-Exercises

  /**
   * This method creates a {@link Uri} for a single term, referenced by id.
   * @param id The id of the term.
   * @return The Uri with the appended id.
   */
  public static Uri buildTermUriWithId(long id) {
    return ContentUris.withAppendedId(CONTENT_URI, id);
  }
}
origin: square/picasso

long id = parseId(requestUri);
origin: naman14/Timber

public static Uri getAlbumArtUri(long albumId) {
  return ContentUris.withAppendedId(Uri.parse("content://media/external/audio/albumart"), albumId);
}
public static String getAlbumArtForFile(String filePath) {
origin: ianhanniballake/TripleSolitaire

  @Override
  protected void onInsertComplete(final int token, final Object cookie, final Uri uri) {
    gameId = ContentUris.parseId(uri);
  }
};
origin: aa112901/remusic

public static Uri getAlbumArtUri(long albumId) {
  return ContentUris.withAppendedId(Uri.parse("content://media/external/audio/albumart"), albumId);
}
android.contentContentUris

Most used methods

  • withAppendedId
  • parseId
  • appendId

Popular in Java

  • Updating database using SQL prepared statement
  • getExternalFilesDir (Context)
  • findViewById (Activity)
  • setRequestProperty (URLConnection)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • Permission (java.security)
    Legacy security code; do not use.
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now