Java Code Examples for android.provider.ContactsContract.Contacts#PHOTO_THUMBNAIL_URI

The following examples show how to use android.provider.ContactsContract.Contacts#PHOTO_THUMBNAIL_URI . 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 vote down vote up
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: ContactsListExample.java    From coursera-android with MIT License 5 votes vote down vote up
@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 3
Source File: ContactsListExample.java    From coursera-android with MIT License 5 votes vote down vote up
@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));
}