CursorLoader setSelection - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for CursorLoader setSelection method.

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;
  } 
} 
7
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());
    cursorLoader.setUri(uri);
    cursorLoader.setProjection(projection);
    cursorLoader.setSelection(selection);
    cursorLoader.setSelectionArgs(selectionArgs);
    cursorLoader.setSortOrder(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);
  } 
} 

7
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());
        cursorLoader.setUri(uri);
        cursorLoader.setProjection(projection);
        cursorLoader.setSelection(selection);
        cursorLoader.setSelectionArgs(selectionArgs);
        cursorLoader.setSortOrder(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);
    } 
} 

7
CodeRank
This code example shows how to use the following methods:setProjection, setSelection, setSortOrder, setUri
        mUnknownNameText = context.getText(android.R.string.unknownName);
    } 
 
    @Override 
    public void configureLoader(CursorLoader loader, long directoryId) {
        loader.setUri(ContactMethods.CONTENT_URI);
        loader.setProjection(POSTALS_PROJECTION);
        loader.setSortOrder(People.DISPLAY_NAME);
        loader.setSelection(ContactMethods.KIND + "=" + android.provider.Contacts.KIND_POSTAL);
    } 
 
    @Override 
    public String getContactDisplayName(int position) {
        return ((Cursor)getItem(position)).getString(POSTAL_DISPLAY_NAME_COLUMN_INDEX);
    } 
 
    public Uri getContactMethodUri(int position) {
        Cursor cursor = ((Cursor)getItem(position));
        long id = cursor.getLong(POSTAL_ID_COLUMN_INDEX);
        return ContentUris.withAppendedId(ContactMethods.CONTENT_URI, id);
8
CodeRank
This code example shows how to use the following methods:setProjection, setSelection, setSelectionArgs, setSortOrder, setUri
     * 
     * @param   uri 
     *          Database URI. 
     */ 
    public QueryLoader(Context context, Uri uri) {
        super(context);
 
        setUri(uri);
        setSortOrder(null);
        setProjection(null);
        setSelection(null);
        setSelectionArgs(null);
    } 
 
    /** 
     * Class constructor. 
     * 
     * @param   context 
     *          Current context. 
     * 
6
CodeRank
This code example shows how to use the following methods:setProjection, setSelection, setSelectionArgs, setSortOrder, setUri
	 
	private long mGroupId;
	 
	 
	public GroupMemberListLoader(Context context, long groupId){
		super(context);
		mGroupId = groupId;
		 
		setProjection(PROJECTION);
		setSelection(createSelection());
		setSelectionArgs(createSelectionArgs());
		setSortOrder(SORT_ORDER);
		setUri(uri);
	} 
 
    private String createSelection() {
        StringBuilder selection = new StringBuilder();
        selection.append(Data.MIMETYPE + "=?" + " AND " + GroupMembership.GROUP_ROW_ID + "=?");
        return selection.toString();
    } 
6
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;
  } 
} 
6
CodeRank
This code example shows how to use the following methods:setProjection, setSelection, setSelectionArgs, setSortOrder, setUri
    private static final String[] SELECTION_ARGS = null;
    private static final String SORT_ORDER = Groups.ACCOUNT_TYPE + ", " + Groups.ACCOUNT_NAME + ", " + Groups.DATA_SET + ", " +
            Groups.TITLE + " COLLATE LOCALIZED ASC";
     
    public GroupListLoader(Context context) {
    	super(context);
    	setUri(GROUP_LIST_URI);
    	setProjection(PROJECTION);
    	setSelection(SELECTION);
    	setSelectionArgs(SELECTION_ARGS);
    	setSortOrder(SORT_ORDER);
    } 
} 
6
CodeRank
This code example shows how to use the following methods:loadInBackground, setSelection, setSelectionArgs, setSortOrder
    } 
 
    @Override 
    public Cursor loadInBackground() {
        // Build the where cause (which can't be done on the UI thread.) 
        setSelection(mSelector.getSelection(mContext));
        setSelectionArgs(mSelector.getSelectionArgs());
        setSortOrder(mSelector.getSortOrder());
        // Then do a query to get the cursor 
        return super.loadInBackground(); 
    } 
 
} 
6
CodeRank
This code example shows how to use the following methods:loadInBackground, setSelection, setSelectionArgs, setSortOrder
    } 
 
    @Override 
    public Cursor loadInBackground() {
        // Build the where cause (which can't be done on the UI thread.) 
        setSelection(mSelector.getSelection(mContext));
        setSelectionArgs(mSelector.getSelectionArgs());
        setSortOrder(mSelector.getSortOrder());
        // Then do a query to get the cursor 
        return super.loadInBackground(); 
    } 
 
} 
6
CodeRank