21

How to load images from the mipmap folder programmatically (as done with the drawables)?

  img.setImageResource(imageId);

I am using Android Studio 1.2.1.

Cœur
  • 37,241
  • 25
  • 195
  • 267
M D
  • 47,665
  • 9
  • 93
  • 114

2 Answers2

63

In Android Studio We have mipmap instead of drawable You Can Find Documents Related To Your Assets Here

You can use it Like

 img.setImageResource(R.mipmap.ic_launcher);
Tufan
  • 2,789
  • 4
  • 34
  • 52
12

You can do

img.setImageResource(R.mipmap.imageid);
Bidhan
  • 10,607
  • 3
  • 39
  • 50