Andorid在指定文件夹中保存图片

来源:互联网 发布:苹果笔记本打不开软件 编辑:程序博客网 时间:2024/05/22 04:56
public void saveMyBitmap(String bitName,Bitmap mBitmap){ File f = new File("/sdcard/课程设计/" + bitName + ".jpg"); try {  f.createNewFile(); } catch (IOException e) {  // TODO Auto-generated catch block } FileOutputStream fOut = null; try {  fOut = new FileOutputStream(f); } catch (Exception e) {  e.printStackTrace(); } mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, fOut); try {  fOut.flush(); } catch (IOException e) {  e.printStackTrace(); } try {  fOut.close(); } catch (IOException e) {  e.printStackTrace(); }}

0 0
原创粉丝点击