Skip to content

Instantly share code, notes, and snippets.

@skatldjs
Created October 22, 2010 01:34
Show Gist options
  • Select an option

  • Save skatldjs/639749 to your computer and use it in GitHub Desktop.

Select an option

Save skatldjs/639749 to your computer and use it in GitHub Desktop.
import android.provider.Contacts.People;
import android.database.Cursor;
String[] projection = new String[] {People._ID,
People._COUNT,
People.NAME,
People.NUMBER };
// Get the base URI for the People table
// in the Contacts content provider.
Uri contacts = People.CONTENT_URI;
// Make the query.
Cursor managedCursor = managedQuery(contacts,
projection, // Which columns to return
null, // Which rows to return (all rows)
null, // Selection arguments (none)
People.NAME + "ASC"); // Put the results in ascending order by name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment