how to set contactphoto

Put your problem here if it does not fit any of the other categories.

how to set contactphoto

Postby surya.n.k » Fri Jul 02, 2010 11:56 am

how to set contactphoto, because i am unable to set the photo using this code it is not shown in list view and when we go to contactdetails view, i am able to see the contact.., can any one give solution for this.
this code i am using to loadcontactphoto in bindview().
int id = cursor.getColumnIndex(People._ID);
Uri uri = ContentUris.withAppendedId(People.CONTENT_URI, cursor.getLong(id));
Bitmap bitmap = People.loadContactPhoto(context, uri, R.drawable.imilogo, null); imageView.setImageBitmap(bitmap);


byte[] photo = null;
Bitmap bm = null;
int id = cursor.getColumnIndex(People._ID);
Cursor contactPhoto = getContentResolver().query(Contacts.Photos.CONTENT_URI, null, Contacts.PhotosColumns.PERSON_ID + "=" + id, null, null);
if (contactPhoto.moveToFirst()) {
photo = contactPhoto.getBlob(contactPhoto.getColumnIndex(Contacts.PhotosColumns.DATA));
bm = BitmapFactory.decodeByteArray(photo, 0, photo.length, null);
Posts: 26
Joined: Fri Dec 07, 2007 7:33 am


Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 10 guests