Just use the convenience method of the openContactPhotoInputStream () class ContactsContract.Contacts, which will return InputStreamcontaining the photo of the contacts, if any. If no photo is installed, it will return null , in which case you should try to set it android.R.drawable.ic_contact_pictureas the default image.
Right Having tried this on your own, it seems like you cannot access a closed Drawable, which is not even recommended. I am stupid.
However, you can simply go to your directory android-sdk/platforms/android-4/data/res/drawableand copy ic_contact_pictureto the drop-down catalog of projects. Then, if the above method returns null, just set what can be done as a photo.
source
share