Android将bitmap保存到自定义路径

来源:互联网 发布:乐乎lofter4.9.0 编辑:程序博客网 时间:2024/06/01 08:05
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();          }         }
0 0
原创粉丝点击