Android: Image save to location

和自甴很熟 提交于 2019-12-01 00:18:13

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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!