Hello,
I am simply trying to get the path of an image that the user selects
and then convert it into a bitmap. The problem is, only some of the
images in the gallery work when selected (by "work" I mean they are
found to be a file that exists), while the others claim the file does
not exist (even though the image is showing up in the gallery?). Even
more strange is that this doesn't seem to be consistent, an image that
was at one point considered to "exist" now claims to be nonexistent.
My code is below:
-----The Intent-----
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("image/*");
startActivityForResult(intent, GALLERY_ACTIVITY);
-----onActivityForResult-----
Uri uri = intent.getData();
String [] proj={MediaStore.Images.Media.DATA};
Cursor cursor = managedQuery(uri,proj,null,null,null);
int column_index =
cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inSampleSize = 2;
Bitmap b =
BitmapFactory.decodeFile(cursor.getString(column_index),opts);
Any ideas on this will be greatly appreciated, thank you!
Matt.
--
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