1
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 makes auto increment in the declared components?
For example: Something that increased the img
: img1
, img2
, img3
... imgN
.
When
bolaPreta == 1
what is assigned to img2 and img3? What is the maximum value of images(imgN)?– ramaral
The maximum image value is 10. When the ballPreta == 1 is assigned nothing, img2 and img3 do not appear in the interface.
– Christian Gomes da Silva