title: How to add random integer array into gridview in android
body: <p>I am doing application and I need to dispaly some images in a gridview. I need to display images in that gridview randomly. So here I taken one integer array like <code>mThumbIds[]</code> in that I add all images, then I take arraylistl like <code>solutionList</code> then that mThumbIds[] intrgerarray.</p>
  
  <p>I added into solutionList array.then i apply random function to that solutionList arrat then agaain i add solutionList array into one integer array like "randomNumbers[]" then finally i add  that randomNumbers[] array to  gridview i get random images but my probem is in gridview  repated images coming,but i dont want repeted images. in mThumbIds[] i am not given repted images.please any one suggest me.</p>
  
  <pre><code>     ImageAdapter .class:
            public class ImageAdapter extends BaseAdapter {
           private Context mContext;
  
  public ImageAdapter(Context c) {
  
      // TODO Auto-generated constructor stub
      mContext = c;
  }
  
  public int getCount() {
      // TODO Auto-generated method stub
      return mThumbIds.length;
  }
  
  public Object getItem(int position) {
      // TODO Auto-generated method stub
      return null;
  }
  
  public long getItemId(int position) {
      // TODO Auto-generated method stub
      return 0;
  }
  
  public View getView(int position, View convertView, ViewGroup parent) {
      ImageView imageView;
  int unique=0;
      if (convertView == null) { // if it's not recycled, initialize some attributes
          imageView = new ImageView(mContext);
          imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
          imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
          imageView.setPadding(8, 8, 8, 8);
      } else {
          imageView = (ImageView) convertView;
      }
        Collections.shuffle(solutionList);
        Integer[] randomNumbers=(Integer[])solutionList.toArray();
      imageView.setImageResource(randomNumbers[unique]);
      unique++;
      return imageView;
  }
  private Integer[] mThumbIds={R.drawable.a,R.drawable.bb,R.drawable.cc,R.drawable.dd,R.drawable.ee,R.drawable.ff,R.drawable.galley,R.drawable.gg};
    List&lt;Integer&gt; solutionList = Arrays.asList( mThumbIds);
  
  }
  </code></pre>