title: displaying images from sd card folder in gallery view(android)
body: <p>I am developing android application.In my application I want to display images from sd card folder in gallery view. I am using BaseAdapter. I tried to display images from drawable folder in resources folder in my project and it's working fine.
  I tried following code:</p>
  
  <pre><code>public class ImageAdapter extends BaseAdapter {
  
  private Context context;  
  public static Integer[] imageIDs={  
          R.drawable.sp1,R.drawable.sp2,
          R.drawable.sp3,R.drawable.sp4,
          R.drawable.sp5,R.drawable.sp6,
          R.drawable.sp7,R.drawable.sp8,
          R.drawable.sp9
  };
  
  public ImageAdapter(Context context){  
      this.context=context;  
  }  
  @Override
  public int getCount() {
      // TODO Auto-generated method stub
      return imageIDs.length;
  }
  
  @Override
  public Object getItem(int position) {
      // TODO Auto-generated method stub
      return position;
  }
  
  @Override
  public long getItemId(int position) {
      // TODO Auto-generated method stub
      return position;
  }
  
  @Override
  public View getView(int position, View 
          convertView, ViewGroup parent) {
      // TODO Auto-generated method stub
      ImageView image=new ImageView(context);  
      image.setImageResource(imageIDs[position]);  
      image.setAdjustViewBounds(true);  
      image.setLayoutParams(new Gallery.LayoutParams(120,120));  
      image.setScaleType(ImageView.ScaleType.FIT_CENTER);
      return image;  
  }
  </code></pre>
  
  <p>Now I want to display images from sd card folder and display them in gallery format.
  for that I tried to get all images in array but I don't know how to get them in array format. I can access my images in sd folder in following manner.</p>
  
  <pre><code>File path = new File(Environment.getExternalStorageDirectory()+"/download/sp1.jpg");
  </code></pre>
  
  <p>How to get them all in array format and display them in gallery view.Or is there any other alternate way to display them instead of array? </p>
  
  <p>Need help.... Thank you....</p>