I'm using a gallery to display selected images from the SD card to the user (as an email attachment manager).
I have the regular image uri as returned from android's build in gallery launched from this code:
Using java Syntax Highlighting
- Intent intent = new Intent();
- intent.setType("image/*");
- intent.setAction(Intent.ACTION_GET_CONTENT);
- startActivityForResult(intent, PICTURE_RETURN);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
Using these full sized images in the gallery, however, quickly exceeds the VM's memory limit. So I've been trying to get a thumbnail version of the same image, but am failing terribly.
Here is my getView from the ImageAdapter class (pics is a Vector<Uri>):
Using java Syntax Highlighting
- public View getView(int position, View convertView, ViewGroup parent) {
- ImageView i = new ImageView(mContext);
- if (convertView == null) {
- Uri uri = pics.elementAt(position);
- Log.i(TAG, "Image Uri = " + uri.toString());
- try {
- i.setImageURI(uri);
- i.setScaleType(ImageView.ScaleType.FIT_XY);
- i.setLayoutParams(new Gallery.LayoutParams(136, 136));
- i.setBackgroundResource(mGalleryItemBackground);
- } catch (Exception e) {
- }
- }
- return i;
- }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
Is there some way to use the uri obtained to get the thumbnail image? Sorry if I've overlooked something obvious. Any help is much appreciated!
Thanks,
--Dan


