Using the system image for contacts without an image on Android

I found this question , which is the same issue that I would like to address.

Reading his question and the accepted answer, it seems like his approach was to pull the actual image file from the resources, embed it in your application and use it as a local resource.

What I would rather do is a property of the source image for my image, use an identifier that will allow me to pull this image from the local system so that my application runs on ICS, HC, GB or Froyo, or if the device manufacturer changed the Android source code and included his own image for photos with an empty contact, that my application will always use the appropriate one from the system in which it works at that time.

Something pseudo-encoded:

if(user.NoPhoto) {
    img.src = loadImageFromId(android.R.drawable.ContactWithoutPhoto)  
}

In the same way, you can use platform styles and lines in your application.
Is there a standard identifier for an image without a photo, hope that?

+2
source share
1

, .

, , SDK :

  • Android 3.0 : drawable-xhdpi-v11, drawable-hdpi-v11, drawable-mdpi-v11 drawable-ldpi-v11.
  • Android 2.3: drawable-xhdpi-v9, drawable-hdpi-v9, drawable-mdpi-v9 drawable-ldpi-v9.
  • : drawable-xhdpi, drawable-hdpi, drawable-mdpi drawable-ldpi.

, .

if(user.NoPhoto) {
    img.setImageResource(R.drawable.ic_contact_picture);  
}
+3

All Articles