Best code examples for Android CursorLoader class (android.support.v4.content.CursorLoader)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android CursorLoader class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android CursorLoader examples from Open Source projects
This code example shows how to use the following methods: getProjection, getSelection, getSelectionArgs, getSortOrder, getUri
    Uri uri = Uri.parse("http://robolectric.org");
    String[] projection = new String[] { "_id", "TestColumn" };
    String selection = "_id = ?";
    String[] selectionArgs = new String[] { "5" };
    String sortOrder = "_id";
    CursorLoader cursorLoader = new CursorLoader(new Activity(),
        uri,
        projection,
        selection,
        selectionArgs,
        sortOrder);
 
    assertThat(cursorLoader.getUri()).isEqualTo(uri);
    assertThat(cursorLoader.getProjection()).isEqualTo(projection);
    assertThat(cursorLoader.getSelection()).isEqualTo(selection);
    assertThat(cursorLoader.getSelectionArgs()).isEqualTo(selectionArgs);
    assertThat(cursorLoader.getSortOrder()).isEqualTo(sortOrder);
  } 
 
  @Test 

9
CodeRank
This code example shows how to use the following methods: getProjection, getSelection, getSelectionArgs, getSortOrder, getUri
        Uri uri = Uri.parse("http://robolectric.org");
        String[] projection = new String[] { "_id", "TestColumn" };
        String selection = "_id = ?";
        String[] selectionArgs = new String[] { "5" };
        String sortOrder = "_id";
        CursorLoader cursorLoader = new CursorLoader(new Activity(),
                uri,
                projection,
                selection,
                selectionArgs,
                sortOrder);
 
        assertThat(cursorLoader.getUri()).isEqualTo(uri);
        assertThat(cursorLoader.getProjection()).isEqualTo(projection);
        assertThat(cursorLoader.getSelection()).isEqualTo(selection);
        assertThat(cursorLoader.getSelectionArgs()).isEqualTo(selectionArgs);
        assertThat(cursorLoader.getSortOrder()).isEqualTo(sortOrder);
    } 
     
    @Test 

9
CodeRank
This code example shows how to use the following methods: setProjection, setSelection, setSelectionArgs, setSortOrder, setUri
    return new WrappedLoaderBuilder<Out>(query.getQueryData(), wrapper);
  } 
 
  public Loader<Cursor> build(Context context) {
    final QueryData queryData = query.getQueryData();
    final CursorLoader loader = new CursorLoader(context);
    loader.setUri(queryData.getUri());
    loader.setProjection(queryData.getProjection());
    loader.setSelection(queryData.getSelection());
    loader.setSelectionArgs(queryData.getSelectionArgs());
    loader.setSortOrder(queryData.getOrderBy());
    return loader;
  } 
} 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods:
public class IdentityLoader extends CursorLoader {
 
  private final Context context;
 
  public IdentityLoader(Context context) {
    super(context);
    this.context      = context.getApplicationContext();
  } 
 
  @Override 
  public Cursor loadInBackground() {
    return DatabaseFactory.getIdentityDatabase(context).getIdentities();
  } 
 
} 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods:
 
  private final String filter;
  private final Context context;
 
  public ConversationListLoader(Context context, String filter) {
    super(context);
    this.filter  = filter;
    this.context = context.getApplicationContext();
  } 
 
  @Override 
  public Cursor loadInBackground() {
    if (filter != null && filter.trim().length() != 0) {
      List<String> numbers = ContactAccessor.getInstance()
          .getNumbersForThreadSearchFilter(filter, context.getContentResolver());
 
      return DatabaseFactory.getThreadDatabase(context).getFilteredConversationList(numbers);
    } else { 
      return DatabaseFactory.getThreadDatabase(context).getConversationList();
    } 
Full Snippet Info
7
CodeRank
See Code Examples for Android CursorLoader Methods: