-1

I have the following requirement:

From the mobile application , I want to open the default gallery of the Android tablet / device , which will contain both the image and video files and select them.

Is there any option to view both image and video files on Android Gallery?

Kindly provide your suggestions.

Sandeep Singh
  • 1,117
  • 2
  • 11
  • 29
chiranjib
  • 5,288
  • 8
  • 53
  • 82

3 Answers3

1

I think, There is no such an option to open both images videos at a time..... But we can filter it before open like this

final CharSequence[] options = {"Images", "Videos", "Cancel"};
        AlertDialog.Builder builder = new AlertDialog.Builder(OpenGallery.this);
        builder.setTitle("Select From...");
        builder.setItems(options, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int item) {
                if (options[item].equals("Images")) {
                    Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                    intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
                    startActivityForResult(intent, 1);
                } else if (options[item].equals("Videos")) {
                    Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Video.Media.EXTERNAL_CONTENT_URI);
                    intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
                    startActivityForResult(intent, 1);
                } else if (options[item].equals("Cancel")) {
                    dialog.dismiss();
                }
                dialog.dismiss();
            }
        });
        builder.show();
Ramaraju
  • 604
  • 1
  • 6
  • 17
0

just try this..

        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(
            "content://media/internal/images/media"));
        startActivity(intent);

Hope it helps ..!

Gagan
  • 745
  • 10
  • 31
-2

try this

Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
photoPickerIntent.setType("images/*,video/*");
startActivityForResult(photoPickerIntent, SELECT_PHOTO);
Sumeet Rathore
  • 232
  • 3
  • 16