private File saveFile(Bitmap bm,String path, String fileName){
File dirFile = new File(path);
if(!dirFile.exists()){
dirFile.mkdir();
}
File myCaptureFile = new File(path , fileName);
try {
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(myCaptureFile));
bm.compress(Bitmap.CompressFormat.JPEG, 80, bos);
bos.flush();
bos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return myCaptureFile;
}
Android笔记(15)将bitmap存为文件
最新推荐文章于 2024-08-09 04:22:11 发布