I have this Image Array which consists of 10 images.
int[] MyArray = new int[10];{
MyArray[0] = R.drawable.a;
MyArray[1] = R.drawable.b;
MyArray[2] = R.drawable.c;
MyArray[3] = R.drawable.d;
MyArray[4] = R.drawable.e;
MyArray[5] = R.drawable.f;
MyArray[6] = R.drawable.g;
MyArray[7] = R.drawable.h;
MyArray[8] = R.drawable.i;
MyArray[9] = R.drawable.j;
}
I have an image view in my activity which i want to fill with a random image from the image array. How do I go about doing this, any help?
To view an image from the array in an image view I use this code
ImageView ImgView = (ImageView)findViewById(R.id.imageView);
ImgView.setImageResource(MyArray);