After switching to Android 4.0 ICS, my application containing a list of contacts with images stopped loading images for these contacts.
After debugging, it seems that the next line always returns NULL.
InputStream input = ContactsContract.Contacts.openContactPhotoInputStream(cr, uri);
I did not change the application at all, right after the transition to ICS, this started to happen.
I have permission READ_CONTACTS.
Does anyone know why this might happen? What could they change? Is this method obsolete or something else?
Full code:
public static Bitmap loadContactPhoto(ContentResolver cr, long id) { Uri uri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, id); InputStream input = ContactsContract.Contacts.openContactPhotoInputStream(cr, uri); if (input == null) { return null; } return BitmapFactory.decodeStream(input); }
source share