保存文件到SDcard

时间:2015-05-06 14:42:23   收藏:0   阅读:212

 1 public void saveToSDCard(String filename, String content)throws Exception {
 2               if(Environment.getExternalStorageDirectory().equals(Environment.MEDIA_MOUNTED)) {
 3             Toast.makeText(this, "SDcard不存在", 1).show();
 4         }else {
 5             File file = new File(Environment.getExternalStorageDirectory(), filename);
 6             FileOutputStream outStream = new FileOutputStream(file);
 7             outStream.write(content.getBytes());
 8             outStream.close();
 9         }
10     
11     }            

 


 

原文:http://www.cnblogs.com/zhangshan/p/4481522.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!