android第十一步把文件保存到SDCard
Environment管理外存储设备
向SD卡输出文件,Environment.getExternalStorageDirectory().toString()SD卡路径
File file = new File(new File(Environment.getExternalStorageDirectory().toString()),filenametext);
FileOutputStream outStream = new FileOutputStream(file);
outStream.write(filecontenttext.getBytes());
outStream.close();
<!-- 在SDCard中创建与删除文件权限 -->
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
<!-- SDCard写入数据权限 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Environment.MEDIA_开头的是当前SD卡的状态
//判断SD是否存在而且可以读取
if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
{