原文地址:http://www.apkbus.com/blog-17085-54589.html
public boolean saveMyBitmap(Bitmap bmp, String bitName) throws IOException {
File dirFile = new File("./sdcard/DCIM/Camera/");
if (!dirFile.exists()) {
dirFile.mkdirs();
}
File f = new File("./sdcard/DCIM/Camera/" + bitName + ".png");
boolean flag = false;
f.createNewFile();
FileOutputStream fOut = null;
try {
fOut = new FileOutputStream(f);
bmp.compress(Bitmap.CompressFormat.PNG, 100, fOut);
flag = true;
} catch (FileNotFoundException e) {
e.printStackTrace();
}
try {
fOut.flush();
} catch (IOException e) {
e.printStackTrace();
}
try {
fOut.close();
} catch (IOException e) {
e.printStackTrace();
}
return flag;
}