I get contact photo URI
Uri uri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, Long.valueOf(contactID));
And I can now show this photo with Picaso:
Picasso.with(mainUserPhoto.getContext())
.load(uri)
.placeholder(R.drawable.image_placeholder)
.error(R.drawable.folder_placeholder)
.into(mainUserPhoto);
It is worked. But I need copy this image to my folder too. How can I copy this contact photo to my Folder?
In the ContactsContract.Contacts
docs there's a convenience method called openContactPhotoInputStream
So you can do:
Uri contactUri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, Long.valueOf(contactId));
InputStream is = ContactsContract.Contacts.openContactPhotoInputStream(getContentResolver(), contactUri, true);
Se save an InputStream
to a local file, see this: https://stackoverflow.com/a/10857407/819355