0
在我的android应用程序中,我需要一个文件选取器,只选择图像和文档。我已经实现了,但它会选择像其他文件像videos.I只需要选择文件,如PDF,Excel, TXT等..和图像和所有那些文件大小5MB.Below是我目前使用的代码。Android:文档和照片选择器的目的
final String[] ACCEPT_MIME_TYPES = {"application/*", "image/*", "text/*" };
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("*/*");
intent.putExtra(Intent.EXTRA_MIME_TYPES, ACCEPT_MIME_TYPES);
//intent.setType("file/*");
intent.addCategory(Intent.CATEGORY_OPENABLE);
try {
startActivityForResult(Intent.createChooser(intent, "Select a File to Upload"),FILE_SELECT_CODE);
} catch (Exception ex) {
System.out.println("browseClick :"+ex);//android.content.ActivityNotFoundException ex
}
我没有我在做什么错在这里,使选择挑选视频和othere files.Please帮我解决这个问题。
'intent.setType(“*/*”);'' – greenapps