The Picasso image downloading library has an interesting feature that I just stumbled upon. It can load Contact photos based on a passed in Contact Uri containing the ContactsContract.Contacts.LOOKUP_KEY. It is as simple as:
- Uri uri = Uri.withAppendedPath(
- ContactsContract.Contacts.CONTENT_LOOKUP_URI, lookupKey);
- Picasso.load(uri).into(myImageView);
It doesn’t seem to be mentioned on the Picasso website, but it is a very useful feature.
If you want to know exactly how Picasso loads the Contact photo, have a look at the ContactsPhotoBitmapHunter class.