31

Is there an intent requesting to get multiple images?

We are aware of Intent.ACTION_PICK or Intent.ACTION_GET_CONTENT for getting a single image. Also our app registers as IntentFilter for android.intent.action.SEND and android.intent.action.SEND_MULTIPLE

However, we would like our app to make use of Gallery like applications to pick multiple images. Is there an intent for that?

Basheer AL-MOMANI
  • 11,997
  • 8
  • 79
  • 85
Miriam
  • 1,158
  • 1
  • 13
  • 23

2 Answers2

27

I also wanted Intent for picking multiple images in android but I failed.I came across custom gallery with custom theme.

Look at here MultipleImagePick to pick single image and to pick multiple image and also you can change theme according to your app.

enter image description hereenter image description hereenter image description here

Updated

Thanks @sunshine for guiding me to limit maximum images selection.

in CustomGalleryActivity.java 

AdapterView.OnItemClickListener mItemMulClickListener = new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> l, View v, int position, long id) {
            if (adapter.getSelected().size() >= MAX_IMAGE_SELECTION_LENGTH) {
                Toast.makeText(getApplicationContext(), "maximum items selected", Toast.LENGTH_LONG).show();
            } else {
                adapter.changeSelection(v, position);
            }

        }
    };
halfer
  • 18,701
  • 13
  • 79
  • 158
Bhavesh Hirpara
  • 21,576
  • 12
  • 60
  • 102
  • 1
    can i put maximum limit of images that user can select like this library provides https://github.com/derosa/MultiImageChooser – AZ_ Jun 13 '14 at 01:49
  • 1
    yes you can set limit in onItemClick of gridview. Pass integer extra frompickbutton and according to that set limit in onItemClick. – Bhavesh Hirpara Jun 13 '14 at 04:07
  • 1
    Awesome library! Is there any way to change the directories that Luminous looks in for images? Or could you point me to the code where this directory is set? On one of the devices I am testing with, Luminous does not see pictures in the Pictures directory, while on other devices, I see pictures from both the Pictures dir and the Camera dir. Any guidance? – wizurd Aug 09 '14 at 05:18
  • 1
    what is the dependency for this library. where i can find this library – roshan posakya Jun 26 '18 at 09:05
16

You need to add this to your manifest:

        <intent-filter>
            <action android:name="android.intent.action.SEND_MULTIPLE" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="image/*" />
        </intent-filter>

I found this post to be extremely helpful, it explains how to also retrieve the images.

ninjasense
  • 13,382
  • 17
  • 71
  • 91
  • 4
    Can you please elaborate more and mentioned exact code? It would be easy for others to implement the same. Because many are defining their own gallery using custom gridview or listview and selecting photos from there. – Paresh Mayani Oct 10 '12 at 07:32
  • 1
    that is for sending images; the question is for getting images; see http://stackoverflow.com/questions/19585815/select-multiple-images-from-android-gallery – M.Y. Jun 02 '14 at 10:25