FileOutputStream保存文件


//保存文件,根據傳入的路徑,存放在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; }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM