Is there a way, rather than individually, to use an Array to define 10 buttons and their associated images, which I have in the res folder?
I have 10 buttons already created in my xml.
I have 10 custom button images in my resource folder.
Images are named my_button_0, my_button_1, ... and so on.
For example:
for (int a = 0; a < 10; a++){
String z = "my_button_" + Integer.toString(a);
Button z = findViewById(R.id.z);
z.setBackgroundResource(R.drawable.z);
}
Found several related questions, but not like this. Thanks.