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)
This directory can be used either with a CONTENT_URI
or
CONTENT_LOOKUP_URI
.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | CONTENT_DIRECTORY | The directory twig for this sub-table | |||||||||
String | PHOTO | Thumbnail photo of the raw contact. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
The directory twig for this sub-table
Thumbnail photo of the raw contact. This is the raw bytes of an image
that could be inflated using BitmapFactory
.
Type: BLOB