Image Resource

A bitmap graphic file (.png, .jpg)

Image (PNG or JPG) file saved at:

res/
  image/
    image_file.png
    image_file1.png
    image_file2.jpg
    image_file3.png

Resource reference

  • XML: @image/image_file
  • Java: Res.image.image_file

Example

Image file saved at res/image/myImage.png:

This layout XML applies a background image to a Button:

<Button backgroundImage="@image/myImage" />

This application code retrieves an image:

Image myImage = ResManager.getImage(Res.string.myImage);