title: How to display images randomly in different image views of gridview with timer in android?
body: <p>i have made the grid view and have all the images in the drawable now what i want is these images come randomly in 9 image view's which i have in grid view, like at 1 second it shows one image as soon as touched by user it dissappears, it displays another image in different image view and it goes on .
  Pls Help if any body has the idea . after dis how to make images randomly appear in image view.</p>
  
  <pre><code>&lt;
  import android.content.Context;
  import android.database.DataSetObserver;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.BaseAdapter;
  import android.widget.GridView;
  import android.widget.ImageView;
  import android.widget.ListAdapter;
  
  public class ImageAdapter extends BaseAdapter {
      private Context mContext;
  
      public ImageAdapter(Context c) {
          mContext = c;
      }
  
      public int getCount() {
          return mThumbIds.length;
      }
  
      public Object getItem(int position) {
          return null;
      }
  
      public long getItemId(int position) {
          return 0;
      }
  
      // create a new ImageView for each item referenced by the Adapter
      public View getView(int position, View convertView, ViewGroup parent) {
          ImageView imageView;
          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;
          }
  
          imageView.setImageResource(mThumbIds[position]);
          return imageView;
      }
  
      // references to our images
      private Integer[] mThumbIds = {
              R.drawable.sample_2, R.drawable.sample_3,
              R.drawable.sample_4, R.drawable.sample_5,
              R.drawable.sample_6, R.drawable.sample_7,
              R.drawable.sample_0, R.drawable.sample_1,
              R.drawable.sample_2, R.drawable.sample_3,
              R.drawable.sample_4, R.drawable.sample_5,
              R.drawable.sample_6, R.drawable.sample_7,
              R.drawable.sample_0, R.drawable.sample_1,
              R.drawable.sample_2, R.drawable.sample_3,
              R.drawable.sample_4, R.drawable.sample_5,
              R.drawable.sample_6, R.drawable.sample_7
      };
  }
  &gt;
  </code></pre>