So here is a full explanation. Currently, I'm building an Android app wherein there will be 3 to 5 images at a time. Then, after pressing an imagebutton (like ¨Forward¨ or ¨Next¨), another set of 3 to 5 images will appear. The set of images will be as follows: first, a .jpg image at the background; second, an smaller .png image in the middle; third, an even smaller .png image up front; along with an imagebutton. And so on.
I'm using Android Studio. I know that I should connect an array in the .java file with ImageView in the .xml file using an object. But, I still can't picture the code in my head.
I thought of using an array, otherwise my .xml file will be massive. I assume. I will do some trial-and-error and post my results, but any help is welcomed.
Store the images inside res/drawable
folder. Suppose the name of the images will be , a.jpg a1.png a2.png
. Now in your java code you can create an integer array like
int icons[] = {R.drawable.a, R.drawable.a1, R.drawable.a2};
Now you can use these values according to your requirements.