我想在用户的手机中搜索文件,因此我使用的是intent.setType
。我有点困惑。我不想搜索视频和图片,但我想搜索所有其他文件,例如pdf
,文字,docx
等。我应该在intent,setType("");
答案 0 :(得分:1)
尝试以下代码;
Intent intent = new Intent();
intent.setType("*/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"Choose File to Upload.."),PICK_FILE_REQUEST);
答案 1 :(得分:1)
试试这个,您可以指定intent.setType
这样的
intent.setType("application/x-excel|application/pdf|text/plain");