4

I'm working on an app that needs to have the user select an image or video. On pre-2.1 devices, using ACTION_GET_CONTENT seems to work fine with multiple MIME types:

new Intent(Intent.ACTION_GET_CONTENT).setType("video/*, image/*")

However, on a Droid running 2.1, this gives a "There are no items in your collection". Using the same code with either "video/" or "image/" gives the desired result. Is there a way to get my 2.1 device to allow the user to select both types of content within a single Intent?

jjb
  • 3,560
  • 1
  • 21
  • 30

1 Answers1

0

Putting the request into a function and then calling the function with onClick().

public void openGalleryImage(){
    Intent intent = new Intent();
    intent.setType("image/*");
    intent.setAction(Intent.ACTION_GET_CONTENT);
    startActivityForResult(Intent.createChooser(intent,"Select Image "),
            SELECT_IMAGE);
}

public void openGalleryVideo(){
    Intent intent = new Intent();
    intent.setType("video/*");
    intent.setAction(Intent.ACTION_GET_CONTENT);
    startActivityForResult(Intent.createChooser(intent,"Select vVideo "), 
            SELECT_VIDEO);
}
Halvor Holsten Strand
  • 19,829
  • 17
  • 83
  • 99