imgView.setImageResource(R.drawable.fl1);
That way I can choose fl1 for image res. But instead of "1" I need to substitute the value of the variable i, i.e. if a:
i = 2, then I need to do - imgView.setImageResource (R.drawable.fl2);
i = 3, then I need to do - imgView.setImageResource (R.drawable.fl3);
etc.
How to achieve this effect?
ps The first thing that comes to mind (of course does not work :))
imgView.setImageResource(R.drawable.fl + i);
UPDATE1 Not one of the answers did not work. At @Gorets, the picture resource simply does not change, and at @ system29a and at @VladD :
The type of the expression must be an array type but it resolved to Map<Integer,Integer>