I am trying to call my different imageButton manually. I have 10 imageButton, they are all named pion1, pion2, pion3, pion4...
I want to change the image of random ImageButton. I want to put the same image everytime, juste change the button where the image will be.
myimage = "pion"+ randonNumber;
myimage.setImageResource(R.drawable.croix);
This code doesn't work because I am not allowed to use string instead of an ImageButton. The random number will be in a function. Anyone has an idea ? Thanks in advance !
Aucun commentaire:
Enregistrer un commentaire