注意:访问SDCard必须在AndroidManifest.xml中加入访问SDCard的权限
if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){ File sdCardDir = Environment.getExternalStorageDirectory();//获取SDCard目录 File saveFile = new File(sdCardDir, “a.txt”); FileOutputStream outStream = new FileOutputStream(saveFile); outStream.write("test".getBytes()); outStream.close(); }Android中的数据存取 之 File(2)
内容版权声明:除非注明,否则皆为本站原创文章。