Hello all,
My app involves selecting an image from the device's gallery and then
saving a smaller version of that image to a folder on the SD Card. The
problem I'm running into is that some users are reporting that the images
aren't getting saved to the folder. Most users, however, report that the
app is working fine and I can't tell what is happening to these other few
users. So far, the devices that are reported to be running into the issue
are as follows: Huawei T-Mobile myTouch, Samsung GT-S5830i, HTC Evo 4G, and
the Samsung Galaxy S2. I myself have a Motorola Atrix 2 and I've had no
such issue.
My manifest has the tag in it already. Most of my code comes from
stackoverflow solutions to get an image from the gallery and then save it
to the sd card.
Getting image from gallery:
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK)
{
switch(requestCode)
{
case SELECT_IMAGE:
image_dir = getPath(data.getData());
Bitmap myBitmap = decodeFile(new File(image_dir));
resizedBitmap = Bitmap.createScaledBitmap(myBitmap,
(int)(myBitmap.getWidth()/2), (int)(myBitmap.getHeight()/2), true);
break;
}
}
else
{
image_dir = "None";
}
}
Saving the image to the SD Card:
OutputStream fOut = null;
File file = new
File(Environment.getExternalStorageDirectory()+"/MyApp",imgname+".jpg");
fOut = new FileOutputStream(file);
resizedBitmap.compress(Bitmap.CompressFormat.JPEG, 100, fOut);
fOut.flush();
fOut.close();
And this all seems to work out fine for most users, but for some users the
image isn't getting saved. Could this be a permissions issue or some sort
of setting I've overlooked in the code itself? Any help is appreciated.
Thanks,
Kyle
--
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