Question

Im building a contact application. In the main activity i have a listview, where i show the contacts.

I'm using a CursorAdapter to handle tha cursor with the list

It all works well without photos.

However, when i try to use photos the scrolling becomes laggish.

Thc calling to open the input stream is very slow, even if the inputStream is null and there's no image to load:

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);
}

What can I do about it?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top