Skip to content

Instantly share code, notes, and snippets.

@dodola
Created August 23, 2013 03:45
Show Gist options
  • Save dodola/6315349 to your computer and use it in GitHub Desktop.
Save dodola/6315349 to your computer and use it in GitHub Desktop.
读取联系人
Cursor query = this.getContentResolver().query(ContactsContract.Data.CONTENT_URI, new String[] { ContactsContract.Data._ID, ContactsContract.CommonDataKinds.Phone.LABEL, ContactsContract.CommonDataKinds.Phone.NUMBER }, "", null, "");
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_2, query, new String[] { ContactsContract.CommonDataKinds.Phone.LABEL, ContactsContract.CommonDataKinds.Phone.NUMBER }, new int[] { android.R.id.text1, android.R.id.text2 }, 0);
mListView.setAdapter(adapter);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment