20

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
  • 34,719
  • 24
  • 185
  • 251
M D
  • 47,398
  • 9
  • 92
  • 112

2 Answers2

62

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
  • 3,384
  • 4
  • 32
  • 53
11

You can do

img.setImageResource(R.mipmap.imageid);
Bidhan
  • 10,387
  • 3
  • 36
  • 48