Display 20 random images over UI screen at a time in Android
<p>HI,</p>

<p>I want to display 20 random images at a time over Activity screen in android. I'm using this snippet:-</p>

<pre><code>ImageView imageArr[] = new ImageView[25];
    int id[]={  R.drawable.letter1,R.drawable.letter2,R.drawable.letter3,R.drawable.letter4,
                R.drawable.letter5,R.drawable.letter6,R.drawable.letter7,R.drawable.letter8,
                R.drawable.letter9,R.drawable.letter10,R.drawable.letter11,R.drawable.letter12,
                R.drawable.letter13,R.drawable.letter14,R.drawable.letter15,R.drawable.letter16,
                R.drawable.letter17,R.drawable.letter18,R.drawable.letter19,R.drawable.letter20};

    ArrayList&lt;Integer&gt; randomArr = new ArrayList&lt;Integer&gt;();
    for(int i=0; i&lt;20;i++) { 
        randomArr.add(i); 
    }
    Collections.shuffle(randomArr);

    for(int i=0; i&lt;20; i++){  
        //ImageView mImageplay = (ImageView)findViewById(R.id.image_play);
        imageArr[i]=(ImageView)findViewById(id[randomArr.get(i)]);
        //mImageplay.setImageResource(id[randomArr.get(i)]);
    }
</code></pre>

<p>Here I'm having 20 custom images of size 49x49 pixels(small sizes)in drawable folder which i want to dispaly over UI at a time in random fashion with no alignment.</p>

<p>The problem is in imageArr[i] is showing NULL value for all the 20 images,whereas "randomArr" is having the correct shuffled data.</p>

<p>Also, Is there any way to display it in randomized look in Layout Area as i was not able to find out solution for this.</p>

<p>I am struck in this and not able to resolve it. please help me out for this.</p>

<p>thanks in advance.
-pk</p>
