Vic*_* I. 5 android android-intent
我试图选择这3种mime类型中的任何一种的文件,它似乎不起作用
Intent photoPickerIntent = new Intent(Intent.ACTION_GET_CONTENT);
photoPickerIntent.setType("image/*, video/*, audio/*");
Run Code Online (Sandbox Code Playgroud)
有人可以建议我怎么做吗?
编写下面的代码而不是您的代码,它可能会对您有所帮助。
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";
}
Run Code Online (Sandbox Code Playgroud)
并使用以下链接作为参考。
| 归档时间: |
|
| 查看次数: |
1398 次 |
| 最近记录: |