1

I am launching an intent to access only images and videos to use in my Android application using the below intent as follows.

    public static final int IMAGE_PICK = 1;
    Intent intent = new Intent();
    intent.setType("*/*");
    intent.setAction(Intent.ACTION_GET_CONTENT);
    startActivityForResult(Intent.createChooser(intent,"Select Any"), IMAGE_PICK);

Using the above I am able to see the images in IO File Manager and also gallery, apart from this I am also seeing Contacts API. But here I don't want to display Contacts API. Any Suggestions.

Thanks&Regards, Venkat.

techi.services
  • 8,473
  • 4
  • 39
  • 42
user1195614
  • 385
  • 2
  • 8
  • 20

1 Answers1

-1
  public static final int IMAGE_PICK = 1;
    Intent intent = new Intent();
    intent.setType("image/*");
    intent.setType("video/*");
    intent.setAction(Intent.ACTION_GET_CONTENT);
    startActivityForResult(Intent.createChooser(intent,"Select Any"), IMAGE_PICK);

try this code to open gallery with only images and videos.

Refer this LINK

Community
  • 1
  • 1
Shankar Agarwal
  • 34,573
  • 7
  • 66
  • 64
  • 2
    I found that (unsurprisingly) multiple calls to setType with different mime-types only sets the last type (in this case video). What worked for me was one call separating the mime-types with a comma e.g. setType("image/*, video/*"); – aaronmarino Jun 19 '14 at 12:29
  • 1
    This answer doesn't work. The documentation is clear, as @aaronmarino points out, that each call to setType() clears out previous calls. – Johnny C Sep 13 '16 at 18:14