Show the photo of a contact on Android

3

I get the photos of the contacts with:

c.getString(c.getColumnIndex(ContactsContract.Contacts.PHOTO_URI)

Returns the path of the photo:

content://com.android.contacts/display_photo/1449

How can I read it and load it in ImageView ?

If it can be with Glide better than better.

    
asked by Webserveis 15.09.2017 в 22:30
source

2 answers

5

If you have the uri of the image, to load it in imageView use the method setImageUri() of imageView .

c.getString(c.getColumnIndex(ContactsContract.Contacts.PHOTO_URI)

imageView.setImageUri(c);
    
answered by 15.09.2017 / 22:37
source
1

The route you get is actually the Uri of the contact image:

content://com.android.contacts/display_photo/1449

In this case you can use the method setImageURI () to directly load the image within ImageView , example:

ImageView imageView =  (ImageView)findViewById(R.id.imageView);
imageView.setImageURI(Uri.parse("content://com.android.contacts/display_photo/1449"));
    
answered by 16.09.2017 в 01:41