I want to setImageResource for an ImageButton programatically, based on a variable.
For eg: if size=5, I want to setImageResource to R.drawable.five
if size=6, I want to setImageResource to R.drawable.six
Unfortunately, I have too many of these, so an if-else or switch gets tiring.
Is there a way to achieve something like: R.drawable.size?
Thanks Chris