BurunduK
BurunduK

Reputation: 293

Android pick intent

I am trying to pick a file with any of these 3 mime types, and it doesn't seem to work

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

Can someone suggest how I can do it ?

Upvotes: 5

Views: 1430

Answers (1)

Dipak Keshariya
Dipak Keshariya

Reputation: 22291

Write below code instead of your code, it may 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 below links for reference.

Pick Intent Example

Upvotes: 1

Related Questions