private void saveMyBitmapToFile(File filePath, Bitmap mBitmap) {
if (filePath == null) {
return;
}
if (!filePath.getParentFile().exists()) {
filePath.getParentFile().mkdirs();
}
FileOutputStream fos = null;
try {
fos = new FileOutputStream(filePath);
if (null != fos) {
mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos);
TMToast.makeText(this, "图片保存成功!", Toast.LENGTH_SHORT).show();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} finally {
if (fos != null) {
try {
fos.flush();
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}