Is there a way to retrieve all the contact photos in one go? I do not want to get photo one by one by using contact id. Is it possible to do this?
Thx! Rahul.
I don't believe that you can get ALL of the photos with one Query. That would be a really big cursor object I feel, plus everything I've read about actually storing photos in a database is troublesome.
Instead you can easily just query all the contacts ids and grab the photos via
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);}