Hi!
I googled for some days and tested quite a few scripts to get contact's photo...
My last version:
public static Bitmap loadContactPhoto(Context context, String myph) {
ContentResolver cr=(ContentResolver) context.getContentResolver();
InputStream input = ContactsContract.Contacts.openContactPhotoInputStr eam(cr, Uri.parse("tel:" + myph));
return BitmapFactory.decodeStream(input);
}
The main problem is to define ContentResolver... If I use image from drawable, everything is ok!
remoteViews.setImageViewResource(R.id.ConButton,R. drawable.ConPhoto);
But I'd like to use contact's photo... Help please!
I googled for some days and tested quite a few scripts to get contact's photo...
My last version:
public static Bitmap loadContactPhoto(Context context, String myph) {
ContentResolver cr=(ContentResolver) context.getContentResolver();
InputStream input = ContactsContract.Contacts.openContactPhotoInputStr eam(cr, Uri.parse("tel:" + myph));
return BitmapFactory.decodeStream(input);
}
The main problem is to define ContentResolver... If I use image from drawable, everything is ok!
remoteViews.setImageViewResource(R.id.ConButton,R. drawable.ConPhoto);
But I'd like to use contact's photo... Help please!