保存文件到SDcard


 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     }            

 


 

posted @ 2015-05-06 12:23  Colaless  阅读(248)  评论(0编辑  收藏  举报