Android 2.1 phone contact

android

Solution

Just use the convenience method openContactPhotoInputStream() of the `ContactsContract.Contacts` class which will return an `InputStream` containing the contacts photo if one is set. If no photo is set it will return null in which case you should try to set `android.R.drawable.ic_contact_picture` as your default image.

Right. After trying it myself it looks like you can't access the private `Drawable`s which is even discouraged. Silly me.

However you can just navigate to your `android-sdk/platforms/android-4/data/res/drawable` directory and copy the `ic_contact_picture` to your projects drawable directory. Then if the method above returns null just set that drawable as your photo.

Problem

in android 2.1 how can i read phone contact image,if no contact image is there i need to get the default one the os provide.

Original source