[英]why file accessing method getExternalStorageDirectory() is not working on Android 10 (API 29)
This is my code to access abc.jpg file in Music folder.这是我在 Music 文件夹中访问 abc.jpg 文件的代码。
String m=Environment.getStorageDirectory().getPath();
inputStream=cr.openInputStream(Uri.parse("file:"+Environment.getExternalStorageDirectory().getPath()+"/Music/abc.jpg"));
when i try to run this code it gives error.当我尝试运行此代码时,它会出错。
File Not Found
We have to add我们必须添加
android:requestLegacyExternalStorage="true"
In Android Mainfest File.在 Android Mainfest 文件中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.