ACTION_GET_CONTENT仅文件,无图像或视频 [英] ACTION_GET_CONTENT only files, no images or videos
问题描述
好吧,我以此开始我的功能
Ok i start my func with this
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType(mimeType);
intent.addCategory(Intent.CATEGORY_OPENABLE);
三星
chooserIntent = Intent.createChooser(sIntent, context.getString(R.string.choosefilefrom));
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] {intent});
用于其他设备
chooserIntent = Intent.createChooser(intent, context.getString(R.string.choosefilefrom));
mimeType是允许使用的类型,此刻其为*/*
.
但是如何排除图像和视频以仅在文件选择器中显示文件?
我有3种意图,一种用于图像,一种用于视频,一种用于文件.
mimeType are the types are allowed to use, its at this moment */*
.
but how to exclude the images and videos to show only files in the file picker?
i have 3 intents, one for images, one for videos and one for files.
推荐答案
您当前正在指定/,即所有内容".
You are currently specifying /, which is "everything".
据我所知,没有用于排除mime类型的机制.
As far as I know, there is no mechanism for exclusion in mime types.
您必须指定要允许的特定的mime类型-无法指定除了这两种mime类型以外的所有内容".
You would have to specify specific mime types that you want to allow - there's no way to specify "everything but these two mime types".
这篇关于ACTION_GET_CONTENT仅文件,无图像或视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!