我正在使用Intent打开文件管理器,我需要知道如何只显示.doc,.docx文件供用户选择.如何将setType放入intent?`Follow函数用于从文件管理器中选择文件.
private void showFileChooser() {
Intent intent = new Intent();
//sets the select file to all types of files
intent.setType("application/*");
//allows to select data and return it
intent.setAction(Intent.ACTION_GET_CONTENT);
//starts new activity to select file and return data
startActivityForResult(Intent.createChooser(intent, "Choose File to Upload.."), PICK_FILE_REQUEST);
}`
Run Code Online (Sandbox Code Playgroud)