网上的方法照抄
<?xml version=”1.0″ encoding=”utf-8″?>
<manifest xmlns:android=”http://schemas.android.com/apk/res/android”
package=”cn.wangchunyang.myapplication”>
<uses-permission android:name=”android.permission.MOUNT_UNMOUNT_FILESYSTEMS”/>
<!– 往SDCard写入数据权限 –>
<uses-permission android:name=”android.permission.WRITE_EXTERNAL_STORAGE”/>
<!– 从SDCard读取数据权限 –>
<uses-permission android:name=”android.permission.READ_EXTERNAL_STORAGE”/>
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String path= Environment.getExternalStorageDirectory()+”/Download”;
File file=new File(path);
if (file.canRead()) {
Log.v(“TAG”, “可读”);
}
if (file.canWrite()) {
Log.v(“TAG”, “可写”);
}else {
Log.v(“TAG”,path);
}
}
}
log 输出 /storage/14EF-260F/Download 这个路径存在啊!
20
看本人机上的实验结果,不能理解了