I am trying to make a button from an image, and the idea is that every click on the button changes the image so the shape and look of the button change too.
E.g., every click gives a point, and every shape or "image" is selected based on an algorithm I made for this purpose
I have these three variables with values generated randomly in this code below:
rand = new Random(System.currentTimeMillis());
x = rand.nextInt(3);
y = rand.nextInt(8);
z = rand.nextInt(10);
The generated numbers are assigned to the string to create the next id
of the image with this code:
String myID = "R.id.myImage_" + x + y + z;
I use this code:
int resource = getResources().getIdentifier(myID, "drawable", "com.asgames.package");
However, I still get an error that the image is not found.