Skip to content Skip to sidebar Skip to footer

Android: Image Save To Location

I'm working on displaying a set of images, then if the users wishes, to have the ability to save the image to the SD card. I need help saving them to external storage. Can someone

Solution 1:

Hi I haven't used the code I'm giving you as part of an application but I did use this to debug bitmaps generated at runtime in one of my apps.

try {
           FileOutputStream out = new FileOutputStream("/sdcard/test2.png");
           mBitmap.compress(Bitmap.CompressFormat.PNG, 90, out);
        } catch (Exception e) {
           e.printStackTrace();
        }

with this code as long as you have a bitmap, you just need this + the manifest permission

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Hope that does the trick for you

Jason


Post a Comment for "Android: Image Save To Location"