When query contacts, we can obtain a PHOTO_ID at the same time. By that ID, we can load the photo bitmap for drawing:
Since android is commonly running on mobile devices, where to store the photo bitmaps is a serious question. For me, I use a SoftReference to store it. Below are the java doc for SoftReference.
There is a bug in android to prevent us to retrieve the contact photo (almost all missing contact photos are facebook porfile photo). To solve this, we must sign the APK by the shared cert and force the app running in shared-uid.