I have make on demo that list all contact from contact Uri in that I have made custom list view after adding of contact image my listview scrolling is very slow, following is my code.
public Bitmap getProfilepicture(Activity activity, String address)
{
Bitmap bitmap;
Uri personUri = Uri
.withAppendedPath(Phones.CONTENT_FILTER_URL, address);
Cursor phoneCursor = activity.getContentResolver().query(personUri,
PHONE_PROJECTION, null, null, null);
if (phoneCursor.moveToFirst()) {
int indexPersonId = phoneCursor.getColumnIndex(Phones.PERSON_ID);
long personId = phoneCursor.getLong(indexPersonId);
phoneCursor.close();
Uri uri = ContentUris.withAppendedId(People.CONTENT_URI, personId);
bitmap = People.loadContactPhoto(activity, uri, R.drawable.icon,
null);
return bitmap;
}
return null;
}
with the help of method I getting contact photo that i use in my getView method. like
holder.imgViewLogo.setImageBitmap(getProfilepicture(activity,pos));
it's working proper but listview performance is low.
please help me out improve performance of listview.