码迷,mamicode.com
首页 > 其他好文 > 详细

FileOutputStream保存文件

时间:2016-08-13 14:11:41      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:

//保存文件,根据传入的路径,存放在SD卡目录下
public
boolean saveToPath(String title, String pageName) { Bitmap b = getChartBitmap(); OutputStream stream = null; try { stream = new FileOutputStream(Environment.getExternalStorageDirectory().getPath() +pageName+ "/" + title + ".png"); /* * Write bitmap to file using JPEG or PNG and 40% quality hint for * JPEG. */ b.compress(CompressFormat.PNG, 40, stream); stream.close(); } catch (Exception e) { e.printStackTrace(); return false; } return true; }

 

FileOutputStream保存文件

标签:

原文地址:http://www.cnblogs.com/kingsam/p/5767832.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!