How to load images from mipmap folder programmatically? [duplicate]
Asked Answered
H

2

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.

Halfsole answered 12/6, 2015 at 10:22 Comment(4)
Can't you just use the id like normal? getDrawable(R.mipmap.your_drawable);Daukas
And the code in your question seems wrong...Daukas
#30801208Octofoil
This question is not a duplicate, he was asking how to reuse the launcher icon, not how to set it as the default launcher.Lackluster
O
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);
Octofoil answered 12/6, 2015 at 10:26 Comment(0)
D
12

You can do

img.setImageResource(R.mipmap.imageid);
Dubois answered 12/6, 2015 at 10:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.