Good people, I have the following code:
if (bolaPreta == 1) {
img1.setImageResource(R.drawable.icon_circpreto);
}
if (bolaPreta == 2) {
img1.setImageResource(R.drawable.icon_circpreto);
img2.setImageResource(R.drawable.icon_circpreto);
}
if (bolaPreta == 3) {
img1.setImageResource(R.drawable.icon_circpreto);
img2.setImageResource(R.drawable.icon_circpreto);
img3.setImageResource(R.drawable.icon_circpreto);
}
Is there any possibility of changing this type of programming, to something that does auto increment in the declared components?
For example, something that is increasing img
: img1
, img2
, img3
... imgN
.