像whatsapp这样的Android文档选择器
我已经能够使用以下代码打开像whatsapp这样的音频文件选择器像whatsapp这样的Android文档选择器,android,Android,我已经能够使用以下代码打开像whatsapp这样的音频文件选择器 Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Audio.Media.EXTERNAL_CONTENT_URI); return intent; 但是,我想以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中不起作用