Android CursorLoader - top ranked examples from Open Source projects

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

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);
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setProjection, setSortOrder, setUri
        mUnknownNameText = context.getText(android.R.string.unknownName);
    } 
 
    @Override 
    public void configureLoader(CursorLoader loader, long directoryId) {
        loader.setUri(Phones.CONTENT_URI);
        loader.setProjection(PHONES_PROJECTION);
        loader.setSortOrder(Phones.DISPLAY_NAME);
    } 
 
    @Override 
    public String getContactDisplayName(int position) {
        return ((Cursor)getItem(position)).getString(PHONE_DISPLAY_NAME_COLUMN_INDEX);
    } 
 
    public Uri getPhoneUri(int position) {
        Cursor cursor = ((Cursor)getItem(position));
        long id = cursor.getLong(PHONE_ID_COLUMN_INDEX);
        return ContentUris.withAppendedId(Phones.CONTENT_URI, id);
    } 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setProjection, setSortOrder, setUri
        mUnknownNameText = context.getText(android.R.string.unknownName);
    } 
 
    @Override 
    public void configureLoader(CursorLoader loader, long directoryId) {
        loader.setUri(People.CONTENT_URI);
        loader.setProjection(PEOPLE_PROJECTION);
        loader.setSortOrder(People.DISPLAY_NAME);
    } 
 
    @Override 
    public String getContactDisplayName(int position) {
        return ((Cursor)getItem(position)).getString(PERSON_DISPLAY_NAME_COLUMN_INDEX);
    } 
 
    public Uri getPersonUri(int position) {
        Cursor cursor = ((Cursor)getItem(position));
        long personId = cursor.getLong(PERSON_ID_COLUMN_INDEX);
        return ContentUris.withAppendedId(People.CONTENT_URI, personId);
    } 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
    setListAdapter(adapter);
    getLoaderManager().initLoader(0, null, this);
  } 
 
  public Loader<Cursor> onCreateLoader(int loaderId, Bundle args) {
    return(new CursorLoader(this, CONTENT_URI, PROJECTION, null, null,
                            CallLog.Calls.DATE+" DESC"));
  } 
 
  public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
    adapter.swapCursor(cursor);
  } 
 
  public void onLoaderReset(Loader<Cursor> loader) {
    adapter.swapCursor(null);
  } 
 
  @Override 
  public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
    long time=0;
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
 
    getLoaderManager().initLoader(0, null, this);
  } 
 
  public Loader<Cursor> onCreateLoader(int loaderId, Bundle args) {
    return(new CursorLoader(this, CalendarContract.Events.CONTENT_URI,
                            PROJECTION, null, null,
                            CalendarContract.Events.DTSTART));
  } 
 
  public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
    adapter.swapCursor(cursor);
  } 
 
  public void onLoaderReset(Loader<Cursor> loader) {
    adapter.swapCursor(null);
  } 
 
  @Override 
  public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android CursorLoader Questions & Answers:

Other Android CursorLoader Examples

49:	        // Now create and return a CursorLoader that will take care of
50:	        // creating a Cursor for the data being displayed.
51:	        return new CursorLoader(this, ContactsContract.Data.CONTENT_URI,
52:	                PROJECTION, SELECTION, null, null);
53:	    }

Read More

See Code Examples for Android CursorLoader Methods: