小编CoX*_*ies的帖子

ACTION_GET_CONTENT 只有文件,没有图片或视频

好的,我用这个开始我的功能

    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    intent.setType(mimeType);
    intent.addCategory(Intent.CATEGORY_OPENABLE);
Run Code Online (Sandbox Code Playgroud)

三星

        chooserIntent = Intent.createChooser(sIntent, context.getString(R.string.choosefilefrom));
        chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] {intent});
Run Code Online (Sandbox Code Playgroud)

对于其他设备

        chooserIntent = Intent.createChooser(intent, context.getString(R.string.choosefilefrom));
Run Code Online (Sandbox Code Playgroud)

mimeType 是允许使用的类型,此时为*/*. 但是如何排除图像和视频以仅显示文件选择器中的文件?我有 3 种意图,一种用于图像,一种用于视频,一种用于文件。

java android file

3
推荐指数
1
解决办法
1696
查看次数

标签 统计

android ×1

file ×1

java ×1