Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/206.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
像whatsapp这样的Android文档选择器_Android - Fatal编程技术网

像whatsapp这样的Android文档选择器

像whatsapp这样的Android文档选择器,android,Android,我已经能够使用以下代码打开像whatsapp这样的音频文件选择器 Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Audio.Media.EXTERNAL_CONTENT_URI); return intent; 但是,我想以whatsapp中显示的方式打开文件选择器。我使用以下代码和其他类似代码。但是,我不能像whatsapp那样显示文档选择器。下面的代码打开文档选择器,它显示资源管理器,并将我带到最近的文件

我已经能够使用以下代码打开像whatsapp这样的音频文件选择器

Intent intent = new Intent(Intent.ACTION_PICK,
        MediaStore.Audio.Media.EXTERNAL_CONTENT_URI);
return intent;
但是,我想以whatsapp中显示的方式打开文件选择器。我使用以下代码和其他类似代码。但是,我不能像whatsapp那样显示文档选择器。下面的代码打开文档选择器,它显示资源管理器,并将我带到最近的文件夹作为起点

final Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
// The MIME data type filter
intent.setType("application/*");
// Only return URIs that can be opened with ContentResolver
intent.addCategory(Intent.CATEGORY_OPENABLE);

它在不同的设备上也有不同的显示。我想让它保持一致。

为迟交答案而道歉。我不知道这正是你想要的答案。但我用下面的代码实现了图像和文档选择器


它在Android 11中不起作用