title: Image Adapter adding ImageViews dynamically to GridView without Cursor
body: <p>I want to keep it short and simple. I have set up an ImageAdapter to a Gridview. Unfortunatley i am working not with the standard picture paths but with some that i created on my own. </p>
  
  <p>Here is my ImageAdapter - under view you will see -imageView.setImageBitmap(extractThumbnail(bm, 10, 10)); - this line only refreshes the current image view... how can i create an image view for each picture with a loop like under Contructor View? - Cursor dont work for me I think, they only can deal with the pre defined content URI's.</p>
  
  <p>I would be glad for some help. Tank you in Advance</p>
  
  <pre><code>private class ImageAdapter extends BaseAdapter {
      private Context mContext;
  
      public ImageAdapter(Context c) {
          mContext = c;
      }
  
      public int getCount() {
          return 1;
      }
  
      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;
          }
  
          File f = new File(IMAGE_DIRECTORY);
          File[] files = f.listFiles();
          imageView.setImageURI(Uri.parse(Environment.getExternalStorageDirectory()+"/MyDir/"));
          for(int i=0; i&lt;files.length; i++){
              Bitmap bm = BitmapFactory.decodeFile(IMAGE_DIRECTORY + File.separator + files[i].getName());
  
              imageView.setImageBitmap(extractThumbnail(bm, 10, 10));
  
          }
           return imageView;
      }
  }
  </code></pre>