android将Bitmap转换成文件
2015-11-30 10:26
555 查看
/**
* 将Bitmap转换成文件
* 保存文件
* @param bm
* @param fileName
* @throws IOException
*/
public static File saveFile(Bitmap bm,String path, String fileName) throws IOException {
File dirFile = new File(path);
if(!dirFile.exists()){
dirFile.mkdir();
}
File myCaptureFile = new File(path , fileName);
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(myCaptureFile));
bm.compress(Bitmap.CompressFormat.JPEG, 80, bos);
bos.flush();
bos.close();
return myCaptureFile;
}
* 将Bitmap转换成文件
* 保存文件
* @param bm
* @param fileName
* @throws IOException
*/
public static File saveFile(Bitmap bm,String path, String fileName) throws IOException {
File dirFile = new File(path);
if(!dirFile.exists()){
dirFile.mkdir();
}
File myCaptureFile = new File(path , fileName);
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(myCaptureFile));
bm.compress(Bitmap.CompressFormat.JPEG, 80, bos);
bos.flush();
bos.close();
return myCaptureFile;
}
相关文章推荐
- Android 中使用的设计模式
- 开源photoview
- Android 颜色值透明度效果设置
- android touch事件分发、拦截和响应分析
- android ContentObserver和DatasetObserver的区别
- android 开机默认语言等其它默认配置项的配置
- Android USB Host的使用详解
- android gradle配置
- android ScrollView滚动距离和判断滚动停止状态
- android:windowSoftInputMode属性详解
- android gridview 属性集合
- android studio 使用retrolambda库 让代码支持lambda 表达式
- android属性动画
- android使用上下文context浅说
- Android SurfaceView的理解与使用
- Android跳转到应用市场进行评分
- android中的提示框:Dialog以及改变Dialog的显示位置
- android学习笔记17 - Cursor的应用
- android 设置下添加时区
- android图片压缩总结2