java.lang.Object | |
↳ | android.provider.ContactsContract.Contacts.Photo |
A read-only sub-directory of a single contact that contains the contact's primary photo.
Usage example:
public InputStream openPhoto(long contactId) { Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId); Uri photoUri = Uri.withAppendedPath(contactUri, Contacts.Photo.CONTENT_DIRECTORY); Cursor cursor = getContentResolver().query(photoUri, new String[] {Contacts.Photo.PHOTO}, null, null, null); if (cursor == null) { return null; } try { if (cursor.moveToFirst()) { byte[] data = cursor.getBlob(0); if (data != null) { return new ByteArrayInputStream(data); } } } finally { cursor.close(); } return null; }
You should also consider using the convenience method
openContactPhotoInputStream(ContentResolver, Uri)
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | CONTENT_DIRECTORY | The directory twig for this sub-table |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
android.provider.BaseColumns
| |||||||||||
From interface
android.provider.ContactsContract.DataColumns
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
|
The directory twig for this sub-table