Java Code Examples for android.provider.ContactsContract.Contacts#_ID
The following examples show how to use
android.provider.ContactsContract.Contacts#_ID .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContactsListActivity.java From coursera-android with MIT License | 6 votes |
private void loadContacts() { // Contact data String columnsToExtract[] = new String[] { Contacts._ID, Contacts.DISPLAY_NAME, Contacts.PHOTO_THUMBNAIL_URI }; // Get the ContentResolver ContentResolver contentResolver = getContentResolver(); // filter contacts with empty names String whereClause = "((" + Contacts.DISPLAY_NAME + " NOTNULL) AND (" + Contacts.DISPLAY_NAME + " != '' ) AND (" + Contacts.STARRED + "== 1))"; // sort by increasing ID String sortOrder = Contacts._ID + " ASC"; // query contacts ContentProvider mCursor = contentResolver.query(Contacts.CONTENT_URI, columnsToExtract, whereClause, null, sortOrder); // pass mCursor to custom list adapter setListAdapter(new ContactInfoListAdapter(this, R.layout.list_item, mCursor, 0)); }
Example 2
Source File: ContactsUtils5.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
@Override public Cursor getContactsByGroup(Context ctxt, String groupName) { if (TextUtils.isEmpty(groupName)) { return null; } String[] projection; if (Compatibility.isCompatible(11)) { projection = new String[] { Contacts._ID, Contacts.DISPLAY_NAME, Contacts.PHOTO_ID, Contacts.CONTACT_STATUS_ICON, Contacts.CONTACT_STATUS, Contacts.CONTACT_PRESENCE, Contacts.PHOTO_URI }; } else { projection = new String[] { Contacts._ID, Contacts.DISPLAY_NAME, Contacts.PHOTO_ID, Contacts.CONTACT_STATUS, Contacts.CONTACT_PRESENCE }; } Uri searchUri = Uri.withAppendedPath(Contacts.CONTENT_GROUP_URI, Uri.encode(groupName)); Cursor c = null; try { c = ctxt.getContentResolver().query(searchUri, projection, null, null, Contacts.DISPLAY_NAME + " ASC"); } catch(Exception e) { Log.e(THIS_FILE, "Error while retrieving group", e); } return c; }
Example 3
Source File: QueryContactsCommand.java From mobilecloud-15 with Apache License 2.0 | 5 votes |
/** * This hook method is called back by the LoaderManager when the * LoaderManager is initialized. */ public Loader<Cursor> onCreateLoader(int id, Bundle args) { // Columns to query. final String columnsToQuery[] = new String[] { ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME, ContactsContract.Contacts.STARRED }; // Contacts to select. final String selection = "((" + Contacts.DISPLAY_NAME + " NOTNULL) AND (" + Contacts.DISPLAY_NAME + " != '' ) AND (" + Contacts.STARRED + "== 1))"; // Create a new CursorLoader that will perform the query // asynchronously. return new CursorLoader(mOps.getActivityContext(), ContactsContract.Contacts.CONTENT_URI, columnsToQuery, selection, null, Contacts._ID + " ASC"); }
Example 4
Source File: DisplayActivity.java From coursera-android with MIT License | 5 votes |
public Loader<Cursor> onCreateLoader(int id, Bundle args) { String select = "((" + Contacts.DISPLAY_NAME + " NOTNULL) AND (" + Contacts.DISPLAY_NAME + " != '' ) AND (" + Contacts.STARRED + "== 1))"; return new CursorLoader(this, Contacts.CONTENT_URI, columnsToExtract, select, null, Contacts._ID + " ASC"); }
Example 5
Source File: ContactsListExample.java From coursera-android with MIT License | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Contact data String columnsToExtract[] = new String[] { Contacts._ID, Contacts.DISPLAY_NAME, Contacts.PHOTO_THUMBNAIL_URI }; // Get the ContentResolver ContentResolver contentResolver = getContentResolver(); // filter contacts with empty names String whereClause = "((" + Contacts.DISPLAY_NAME + " NOTNULL) AND (" + Contacts.DISPLAY_NAME + " != '' ) AND (" + Contacts.STARRED + "== 1))"; // sort by increasing ID String sortOrder = Contacts._ID + " ASC"; // query contacts ContentProvider Cursor cursor = contentResolver.query(Contacts.CONTENT_URI, columnsToExtract, whereClause, null, sortOrder); // pass cursor to custom list adapter setListAdapter(new ContactInfoListAdapter(this, R.layout.list_item, cursor, 0)); }
Example 6
Source File: ContactsListExample.java From coursera-android with MIT License | 5 votes |
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { // String used to filter contacts with empty or missing names or are unstarred String select = "((" + Contacts.DISPLAY_NAME + " NOTNULL) AND (" + Contacts.DISPLAY_NAME + " != '' ) AND (" + Contacts.STARRED + "== 1))"; // String used for defining the sort order String sortOrder = Contacts._ID + " ASC"; return new CursorLoader(this, Contacts.CONTENT_URI, CONTACTS_ROWS, select, null, sortOrder); }
Example 7
Source File: DisplayActivity.java From coursera-android with MIT License | 5 votes |
public Loader<Cursor> onCreateLoader(int id, Bundle args) { String select = "((" + Contacts.DISPLAY_NAME + " NOTNULL) AND (" + Contacts.DISPLAY_NAME + " != '' ) AND (" + Contacts.STARRED + "== 1))"; return new CursorLoader(this, Contacts.CONTENT_URI, columnsToExtract, select, null, Contacts._ID + " ASC"); }
Example 8
Source File: ContactsListExample.java From coursera-android with MIT License | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Contact data String columnsToExtract[] = new String[] { Contacts._ID, Contacts.DISPLAY_NAME, Contacts.PHOTO_THUMBNAIL_URI }; // Get the ContentResolver ContentResolver contentResolver = getContentResolver(); // filter contacts with empty names String whereClause = "((" + Contacts.DISPLAY_NAME + " NOTNULL) AND (" + Contacts.DISPLAY_NAME + " != '' ) AND (" + Contacts.STARRED + "== 1))"; // sort by increasing ID String sortOrder = Contacts._ID + " ASC"; // query contacts ContentProvider Cursor cursor = contentResolver.query(Contacts.CONTENT_URI, columnsToExtract, whereClause, null, sortOrder); // pass cursor to custom list adapter setListAdapter(new ContactInfoListAdapter(this, R.layout.list_item, cursor, 0)); }
Example 9
Source File: ContactsListActivity.java From coursera-android with MIT License | 5 votes |
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { // String used to filter contacts with empty or missing names or are unstarred String select = "((" + Contacts.DISPLAY_NAME + " NOTNULL) AND (" + Contacts.DISPLAY_NAME + " != '' ) AND (" + Contacts.STARRED + "== 1))"; // String used for defining the sort order String sortOrder = Contacts._ID + " ASC"; return new CursorLoader(this, Contacts.CONTENT_URI, CONTACTS_ROWS, select, null, sortOrder); }