Android pick intention

I am trying to select a file with any of these three types of mime and it doesn't seem to work

Intent photoPickerIntent = new Intent(Intent.ACTION_GET_CONTENT);
photoPickerIntent.setType("image/*, video/*, audio/*");

Can anyone suggest how I can do this?

+5
source share
1 answer

Write the code below instead of the code, it can help you.

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";
}

And use the links below for the link.

Choose an example of intention

+1
source

All Articles