android - How to access different 'global' elements without array? (Java) -


itemprop = "text">

I am currently developing Android.

Category R (an automatically generated square) is that many 'global' values ​​have been accessed anywhere:

  R.drawable. & Lt; File_name_ignoring_suffix & gt;   

I have many files named 'item_0.png', 'item_1.png', 'item_2.png'

Is there an easy way to recycle these items without first putting them in the array?

My current implementation:

  int [] itemResources = {R.drawable.item_0, R.drawable.item_1, R.drawable.item_2, R.drawable.item_3 , R.drawable.item_4, R.drawable.item_5};   

... then walk through the array again.

It works well, but it is not particularly helpful, and I have a lot of things when it gets labor intensive.

Any thoughts?

You can of course use the code to get the list of fields> R. Drawable . This is a kind of hack, but it can work for you.

Comments