HI, This question is related to get the gallery View from the images stored in the /data or sdcard folder.
I have modified the source code<http://developer.android.com/resources/tutorials/views/hello-gallery.html>from the android.developer site for gallery view of images kept in Drawable folder. To display the same images on Click I have modified it as follows, to view the image on click : public void onItemClick(AdapterView<?> parent, View v, int position, long id) { // Toast.makeText(HelloGallery.this, "" + position, Toast.LENGTH_SHORT).show(); ImageView imageView = (ImageView) findViewById(R.id.image1); imageView.setImageResource(mImageIds[position]); > Setting the Image IDs in the setImageResource.This is simple as the images are static and are already present in the Drawable folder. Here is the code snippet(main parts) for the above : public class HelloGallery extends Activity implements { private Integer[] mImageIds = { R.drawable.sample_1, R.drawable.sample_2, R.drawable.sample_3, }; Gallery gallery = (Gallery) findViewById(R.id.gallery1); gallery.setAdapter(new ImageAdapter(this)); gallery.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { // Toast.makeText(HelloGallery.this, "" + position, Toast.LENGTH_SHORT).show(); ImageView imageView = (ImageView) findViewById(R.id.image1); imageView.setImageResource(mImageIds[position]); } public class ImageAdapter extends BaseAdapter { public View *getView*(int position, View convertView, ViewGroup parent) { ImageView imageView = new ImageView(mContext); * imageView.setImageResource(mImageIds[position]);* imageView.setLayoutParams(new Gallery.LayoutParams(150, 120)); imageView.setScaleType(ImageView.ScaleType.FIT_XY); imageView.setBackgroundResource(mGalleryItemBackground); return imageView; } } But now I want the images to be picked from the SD card or /data folder instead from the Drawable f <http://folder.is>older. So is it possible to get the * resource id of the files(JPEG, PNG ) so that I can reuse the above code.* Other way could be using bitmap for setting the view of all the images in the /data (Not sure) public View *getView*(int position, View convertView, ViewGroup parent) { File imgFile = new File("*/data/1321296131284.jpg*"); Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath()); ImageView imageView = new ImageView(mContext); // imageView.setImageResource(mImageIds[position]); imageView.setImageBitmap(myBitmap); imageView.setLayoutParams(new Gallery.LayoutParams(150, 120)); imageView.setScaleType(ImageView.ScaleType.FIT_XY); imageView.setBackgroundResource(mGalleryItemBackground); return imageView; } But I am not getting the thumbnails of the images by this method nor the image on clicking it.I am getting a grey thumbnail out of it. PLz suggest/advice to achieve this. Plz advice. Rgds, Saurabh "..pain is temporary.....quitting lasts forever......" -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

