0

How can I change my code to put an option in my application which give the user the option to choose either a single for a couple of photos to upload in their profile? At the moment I'm using the following code ....... ,but it doesn't allow the user to choose a single image and its limits is at least 2 photos

So how should I change my code?

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 images"), CODE_MULTIPLE_IMG_GALLERY);
Miss Chanandler Bong
  • 4,081
  • 10
  • 26
  • 36
mahsa
  • 1
  • 1
  • What do you want? To select only one picture or to select 1 or 2? See https://stackoverflow.com/questions/31002388/android-intent-extra-allow-multiple-allows-only-single-picking, they write: "It requires Long press to activate multiple select mode". – CoolMind Apr 05 '20 at 19:01
  • @CoolMind i want to select 1 or 2 or 3 picture. this code allow me for select more than 1 picture. – mahsa Apr 05 '20 at 19:34
  • And what is a problem? You can select only 2 or 3, but not 1? – CoolMind Apr 05 '20 at 21:08
  • @CoolMind Yes, exactly – mahsa Apr 05 '20 at 21:18

0 Answers0