jimmy Posted December 11, 2010 Share Posted December 11, 2010 Bonjour, J'ai un souci, je voudrais récupérer la photos des contact du téléphone mais je n'y arrive pas totalement... Si la photos viens de facebook ou twitter je n'arrive pas a la récupérer, j'obtiens un "null" Voici comment je fais : public static Bitmap loadContactPhoto(Context context, Long contactId) { Uri contactPhotoUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId); ContentResolver cr=(ContentResolver) context.getContentResolver(); InputStream input = ContactsContract.Contacts.openContactPhotoInputStream(cr, contactPhotoUri); Bitmap b = BitmapFactory.decodeStream(input); if(b==null){ return ((BitmapDrawable)context.getResources().getDrawable(R.drawable.icon)).getBitmap(); }else{ return b; } } Merci de m'aider. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.