且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Android中从外部存储打开文件

更新时间:2023-11-22 21:30:46

我看到了您的错误消息:

I see your error message :

java.io.FileNotFoundException:/storage/emulated/0/test.xml(权限被拒绝)

java.io.FileNotFoundException: /storage/emulated/0/test.xml (Permission denied)

请记住,您必须在运行Android 6.0的操作系统上运行必须实现 尝试读取或写入外部存储之前的运行时权限.

Remember that running on running Android 6.0 you must implement runtime permissions before you try to read or write the external storage.

将其设置为manifest.xml对于使用Android 6.0及更高版本的设备是不够的:

setting this into your manifest.xml is not enough for devices with Android 6.0+:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />