Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 0.41 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Load contact photos in list view (with CursorAdapter) is very laggish
  2. public static Bitmap loadContactPhoto(ContentResolver cr, long  id)
  3. {
  4.    Uri uri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, id);
  5.    InputStream input = ContactsContract.Contacts.openContactPhotoInputStream(cr, uri);
  6.  
  7.    if (input == null)
  8.    {
  9.        return null;
  10.    }
  11.  
  12.    return BitmapFactory.decodeStream(input);
  13. }