Android-Universal-Image-Loader icon indicating copy to clipboard operation
Android-Universal-Image-Loader copied to clipboard

Can't display PHOTO_THUMBNAIL_URI

Open Lingviston opened this issue 9 years ago • 6 comments

I get PHOTO_THUMBNAIL_URI from contacts content provider. But image is not displayed by UIL. Here's uri example: content://com.android.contacts/contacts/67/photo Main page says that "content" uri is supported.

Lingviston avatar May 18 '15 15:05 Lingviston

Important information: the same thumbnail displayed correctly if I pass it to ImageView.setImageUri.

Lingviston avatar May 19 '15 09:05 Lingviston

Also looked at the code and found these strings:

else if (imageUri.startsWith(CONTENT_CONTACTS_URI_PREFIX)) { // contacts photo
    return getContactPhotoStream(uri);
}

Looks like it expects contact uri only but not contact photo. Ok, I got the ContactsContract.Contacts._ID and constructed the Uri like this:

Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, id);

But passing this Uri to ImageLoader doesn't work either. So how can I display contact photo via UIL?

Lingviston avatar May 19 '15 09:05 Lingviston

I also met this bug. The ImageLoader dose not work only if the URI is "content://com.android.contacts/contacts/{CONTACT_ID}". Try this.

AkiChang-Dev avatar Jun 29 '15 12:06 AkiChang-Dev

@Lingviston @zeatual +1, if I use ContactsContract.CommonDataKinds.Photo.CONTACT_ID everything works fine. I have read on stackoverflow, that it is common mistake to use ContactsContract.Contacts._ID.

http://stackoverflow.com/questions/5332333/android-getting-contacts-photo-from-data-email-query

so if your problem is solved, issue should be closed.

Truerall avatar Jul 13 '15 23:07 Truerall

@zeatual tried that, didn't work. @Truerall perhaps your're right. I'm not able to test it right now and actually made a workouround extending BaseImageDownloader as far as I remember. However I think this have to be added to documentation.

Lingviston avatar Jul 14 '15 16:07 Lingviston

Is there a workaround for this?

AndroidDeveloperLB avatar Sep 28 '17 07:09 AndroidDeveloperLB