jimmy Posté(e) 11 décembre 2010 Posté(e) 11 décembre 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.
Recommended Posts
Archivé
Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.