title: How to show image and video as thumbnail in grid view?
body: <p>I have a database which contains list of image and video path. My problem is I have to show all the images and video in a <code>GridView</code>. I have taken list of path from database but I am not able to show them in GridView. Please help me. Here is my code. 
  Thanks in Advance</p>
  
  <pre><code> public class GridGallery extends Activity
  {
  
      ArrayList&lt;String&gt;list;
  
      @Override
      public void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.grid_gallery);
          DataModel dbModel = new DataModel(this);
          list = dbModel.selectAll();
  
          GridView sdcardImages = (GridView) findViewById(R.id.sdcard);
          sdcardImages.setAdapter(new ImageAdapter(this));
  
      }
  
  
       /**
       * Adapter for our image files.
       */
      private class ImageAdapter extends BaseAdapter {
  
          private final Context context; 
  
          public ImageAdapter(Context localContext) {
              context = localContext;
          }
  
          public int getCount() 
          {
              return list.size();
          }
          public Object getItem(int position) 
          {
              return position;
          }
          public long getItemId(int position) 
          {
              return position;
          }
  
          public View getView(int position, View convertView, ViewGroup parent) 
          {
              ImageView picturesView;
              if (convertView == null) {
                  picturesView = new ImageView(context);
  
                  for(int i=0;i&lt;list.size();i++)
                  {
                      Bitmap mBitmap = BitmapFactory.decodeFile(list.get(i));
                      picturesView.setImageBitmap(mBitmap);
                  }
                  picturesView.setScaleType(ImageView.ScaleType.FIT_CENTER);
                  picturesView.setPadding(8, 8, 8, 8);
                  picturesView.setLayoutParams(new GridView.LayoutParams(100, 100));
              }
              else 
              {
                  picturesView = (ImageView)convertView;
              }
              return picturesView;
          }
      }
  
  }
  </code></pre>