Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use "lookupKey" to get Contact Image?
    primarykey
    data
    text
    <p>I have lookupkeys for contact, now I want to obtain Contact Images as Bitmap/InputStream using these lookupkeys. Android documentation helps getting Images but with contacts id not lookupkey.</p> <pre><code>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; } </code></pre> <p>Running from pillar to post but no help. Thanks</p> <p><strong>Edit Dated 04-09-2012</strong></p> <p>Tried as suggested by @Sreejith Krishnan R but received the following exceptions in logcat</p> <pre><code>09-04 03:16:26.359: E/AndroidRuntime(24008): java.lang.IllegalArgumentException: URI: content://com.android.contacts/contacts/lookup/0r272-382C544E2C562C382C4E582C42.2649i11.1987r6285-382C544E2C562C382C4E582C42.1987r6440-382C544E2C562C382C4E582C42.2829r6475-382C544E2C562C382C4E582C42/photo, calling user: com.xyz, calling package:com.xyz 09-04 03:16:26.359: E/AndroidRuntime(24008): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:144) 09-04 03:16:26.359: E/AndroidRuntime(24008): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:114) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload