Try setting up a few int arrays to store your drawable and widget IDs. It's faster than using reflection to find them by name. Something like this should do the trick.
Try setting up a few int arrays to store your drawable and widget IDs. It's faster than using reflection to find them by name. Something like this should do the trick: int imageViews = { R.id.
A0, R.id. A1, R.id. B0, R.id.
B1, R.id. C0, R.id. C1 //... }; int images = { R.drawable.
A0, R.drawable. A1, R.drawable. B0, R.drawable.
B1, R.drawable. C0, R.drawable. C1 //... }; Random random = new Random(System.
CurrentTimeMillis()); for(int v : imageViews) { ImageView iv = (ImageView)findViewById(v); iv. SetImageResource(imagesrandom. NextInt(images.
Length - 1)); } You may want to add some special handling if you want to ensure that all the ImageViews get unique images, but that should work as is.
Just realized I had sTiles. Length in my code; should have been images.length. :) Changed it.
– kcoppock Feb 25 at 22:02 I used this code for my app, randomly images are changing but some images repeating. I want on image for one imageview.. please help me.. – RajaReddy P Sep 19 at 11:45.
An solution is read with reflection the values from R. Drawable and load it as Bitmap by getting the value of the field in R. It's something like: public static void example() throws IllegalArgumentException, IllegalAccessException{ Class clazz = R.drawable.
Class; for(Field field : clazz. GetDeclaredFields()){ Bitmap bmp = BitmapFactory. DecodeResource(getResources(), (Integer) field.
Get(null)); //bmp is your image } }.
You'll have to make some sort of container(Linear Or Relative layout possibly) and add the images to the view. Example: RelativeLayout cbrl = new RelativeLayout(this); RelativeLayout. LayoutParams cbp = new RelativeLayout.
LayoutParams( LayoutParams. WRAP_CONTENT, LayoutParams. WRAP_CONTENT); cbVal.
SetLayoutParams(cbp); for(i=0; I XX); cbrl. AddView(iv); }.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.