Android将bitmap保存到自定义路径
16lz
2021-01-23
public void saveMyBitmap(String bitName,Bitmap mBitmap){ File f = new File("/sdcard/" + bitName + ".jpg"); picPath="/sdcard/" + bitName + ".png"; try { f.createNewFile(); } catch (IOException e) { // TODO Auto-generated catch block // DebugMessage.put("在保存图片时出错:"+e.toString()); } FileOutputStream fOut = null; try { fOut = new FileOutputStream(f); } catch (FileNotFoundException e) { e.printStackTrace(); } mBitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut); try { fOut.flush(); } catch (IOException e) { e.printStackTrace(); } try { fOut.close(); } catch (IOException e) { e.printStackTrace(); } }
更多相关文章
- android 多点触摸 实现图片缩放 Image Zoom
- Android应用程序之间共享文字和图片(二)
- android中setImageResource加载大图片出现oom解决方案
- Android跳转系统相机或相册获取图片
- android对大图片的缓存处理
- android 根据SD卡中图片路径读取并显示SD中的图片――源代码
- Android中多层Fragment嵌套,调用相册返回Uri无法显示图片的问题解
- Android WebView图片显示问题
- android 缩放图片与内存溢出