我正在尝试选择具有这3种mime类型中的任何一种的文件,但它似乎不起作用
Intent photoPickerIntent = new Intent(Intent.ACTION_GET_CONTENT);
photoPickerIntent.setType("image/*, video/*, audio/*");有人能建议我怎么做吗?
发布于 2012-07-06 16:37:59
写下面的代码而不是你的代码,这可能会对你有帮助。
private static final int PICTURE = 0;
private static final int VIDEO = 1;
private static final int AUDIO = 2;
Intent photoPickerIntent = new Intent(Intent.ACTION_GET_CONTENT);
String title = GET_PICTURE;
if (this.mediaType == PICTURE) {
photoPickerIntent.setType("image/*");
title = "GET_PICTURE";
}else if (this.mediaType == VIDEO) {
photoPickerIntent.setType("video/*");
title = "GET_VIDEO";
}else if (this.mediaType == AUDIO) {
photoPickerIntent.setType("audio/*");
title = "GET_AUDIO";
}并使用下面的链接作为参考。
https://stackoverflow.com/questions/11358646
复制相似问题