/** 保存方法 */ public void saveBitmap(Bitmap bm, String picName) { //获取SD卡的目录,不建议直接写sdcard File f = new File(Environment.getExternalStorageDirectory().getPath(),picName); //若存在,则删除 if (f.exists()) { f.delete(); } try { FileOutputStream out = new FileOutputStream(f); bm.compress(Bitmap.CompressFormat.PNG, 90, out); out.flush(); out.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }