Search code examples
androidandroid-gallery

Not able to pick photos and videos from Google photos app in nexus 5 marshmallow


I'm having problems picking up a photo and a video at the same time in nexus 5 with "google photos" app. In other applications it works fine, the issue is only with google photos. Please help me so that I can see the full gallery (not only pic or only video).

This is the onclick of my button:

@Click(R.id.ivGallery)
    void addMedia() {
        Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
        intent.setType("*/*");
        intent.setType("image/jpeg");
        intent.setType("video/mp4");
        startActivityForResult(intent, GALLERY_REQUEST_CODE);
    }

Solution

  • You can use this to pick all types of Files.

     Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
     intent.addCategory(Intent.CATEGORY_OPENABLE);
     intent.setType("*/*");
     startActivityForResult(intent, PICKFILE_REQUEST_CODE);