if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
//返回一个File对象,其路径是sd卡的真实路径
File f = new File(Environment.getExternalStorageDirectory(),"info.txt");
FileOutputStream fos;
try {
fos = new FileOutputStream(f);
//把『username:pwd』写入info.txt中
fos.write("username:pwd".getBytes());
fos.close();
}catch (Exception e){
e.printStackTrace();
}
}