从Android 10上的URI获取文件路径,
我需要从设备中选取文件 这是我的密码从Android 10上的URI获取文件路径,,android,filepicker,android-10.0,Android,Filepicker,Android 10.0,我需要从设备中选取文件 这是我的密码 Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("*/*"); String[] mimeTypes = {"image/*", "application/pdf"}; intent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes); startAc
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("*/*");
String[] mimeTypes = {"image/*", "application/pdf"};
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes);
startActivityForResult(intent, PICK);
在Android 10设备上选择的URI url总是这样
content://com.android.providers.downloads.documents/document/msf:75878
我尝试了许多不同的解决方案从这个URI获取文件路径,但没有成功
注意:我的应用程序在Android 10之前的设备上运行得非常好,我能够获取拾取的文件路径。使用路径已经很长一段时间不受欢迎了,它最终在Android 10中被禁用。你找到答案了吗。。我在Android 10上也很难做到这一点。@SwapnilKale在Android 10上没有不推荐的路径,而是使用选择的文件URI,intent.getData()这个问题对于类似文件管理器的应用程序来说也很有趣。我想不出检索文件路径的方法=/这个问题的解决方案是什么