Android 设置意图类型,不包括图像和视频,但包括所有其他内容
我想在用户手机上搜索文件,所以我使用的是Android 设置意图类型,不包括图像和视频,但包括所有其他内容,android,android-intent,Android,Android Intent,我想在用户手机上搜索文件,所以我使用的是intent.setType。我有点困惑。我不想搜索视频和图像,但我想搜索所有其他文件,如pdf、文本、docx等。我应该在intent、setType(“”)中写什么尝试下面的代码 Intent intent = new Intent(); intent.setType("*/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Inten
intent.setType
。我有点困惑。我不想搜索视频和图像,但我想搜索所有其他文件,如pdf
、文本、docx
等。我应该在intent、setType(“”)中写什么代码>尝试下面的代码
Intent intent = new Intent();
intent.setType("*/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"Choose File to Upload.."),PICK_FILE_REQUEST);
试试这个,你可以像这样指定你的intent.setType
intent.setType("application/x-excel|application/pdf|text/plain");
我没有使用intent.setType(“/”);但它只显示需要文件浏览器应用程序的图像和视频文件