标签:
//获取SD卡得存储状态
state= Environment.getExternalStorageState();
//获取SD卡存储位置
f=Environment.getExternalStorageDirectory();
File ff=null;
if(state.equals(Environment.MEDIA_MOUNTED)){
ff=new File(f.getAbsolutePath(),"cy.txt");
if(!ff.exists()){
try {
ff.createNewFile();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
try {
FileWriter fw=new FileWriter(ff);
fw.write(s);
fw.flush();
fw.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
标签:
原文地址:http://www.cnblogs.com/hnpy/p/5587036.html