Home > database >  allow user to select only 5 images in android studio
allow user to select only 5 images in android studio

Time:04-04

How to enable user select only 5 images from gallery

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

I tried this but didn't restrict from 5 images only

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

CodePudding user response:

Presently, there is nothing for this in Android.

Android 13 is set to introduce a photo picker that does allow you to limit the number of selected images. The docs hint that Google might make this available for slightly older devices, back to Android 11.

Otherwise, see if there is a library that does what you want.

  • Related