0

由于存储框架的变化,我无法列出设备上的所有 pdf 文件。这是我的代码:

String pdf = MimeTypeMap.getSingleton().getMimeTypeFromExtension("pdf");
Uri table = MediaStore.Files.getContentUri("external");
String[] column = {MediaStore.Files.FileColumns.DATA};
String where = MediaStore.Files.FileColumns.MIME_TYPE + "=?";
String[] args = {pdf};
Cursor cursor = context.getContentResolver().query(table, column, where, args, null);

有没有其他方法可以获取设备上的所有 pdf 文件?必须有一些解决方法(除了 requestLegacyExternalStorage),因为许多应用程序依赖于处理位于其范围存储之外的文件(图像、音频)。

4

0 回答 0