Eugene Shmorgun
Eugene Shmorgun

Reputation: 2065

How to iterate drawblesin Android?

In my app I have in hdpi-drawables folder rather big number of graphics file, which are need to be the icons in list activity. So in my ArrayAdapter I set the values to setImageDrawable

So, I need the way to iterate the all files, which are in my resources to get the namesand some another properties from their. Is there any way to do it?

Upvotes: 0

Views: 32

Answers (1)

vasart
vasart

Reputation: 6702

You can find drawable id by it's name with this method

int id = getResources().getIdentifier("name_of_resource", "drawable", getPackageName());

Upvotes: 1

Related Questions