Opening multiple images in gallery intent

I need to open several images in the gallery for viewing using moving ... I know how to open 1 image.

Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("file://" + "/sdcard/test.jpg"), "image/*");
startActivity(intent);

How can I view multiple images to view them all, gliding in the same intention.? I have a way to images ... And I need to view them in the gallery.

+4
source share
4 answers

No, you cannot do this ... You need to create a new activity of the form

0
source

The EXTRA_ALLOW_MULTIPLE parameter is set in the intent using the Intent.putExtra () method to select multiple images

API 18

intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);

:

Intent intent = new Intent(); intent.setType("image/*");
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"Select Picture"),1);
+2

, .

Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
                photoPickerIntent.setType("image/*");
                startActivityForResult(photoPickerIntent, SELECT_PHOTO);
+1

:

1.Intent

2. .

:

Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE);

. : http://www.technotalkative.com/android-select-multiple-photos-from-gallery/

gridview

+1

Source: https://habr.com/ru/post/1664901/


All Articles