public void saveMyBitmap(String bitName, Bitmap mBitmap) throws IOException {
File f = new File("/sdcard/" + bitName + ".png");
f.createNewFile();
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-保存Bitmap到SDCard
最新推荐文章于 2021-02-16 11:22:49 发布