user2803277
user2803277

Reputation: 51

Default image for contact Android 4.3

I can't seem to find the resource on the device for the default contact image. I was only able to find this sdk/platforms/android-18/data/res/drawable-xhdpi/ic_contact_picture.png, however once I try using this photo and setting the contact photo in my code using this image (which I've added to /assets), the quality does not match the default on the device.

Could there possibly be a URI that has this image on the device already?

Upvotes: 0

Views: 1219

Answers (1)

Luis Mendo
Luis Mendo

Reputation: 112699

In order to match different screen resolutions you need to use the MDPD / HDPI / XHDPI versions.

The easiest way is to copy the different versions of the images in the res/drawable-mdpi, res/drawable-hdpi and res/drawable-xhdpi folders of your project, using the same filename, ic_contact_picture (you will find them in the same path as you mention, only replacing "xhdpi"). You then refer to the image in your Java code as

R.drawable.ic_contact_picture

or in XML as

android:drawable="@drawable/ic_contact_picture"

This way, the system will automatically choose the version which matches your resolution.

Upvotes: 1

Related Questions