0

I am using android java. And I am trying to let user to upload photos to my application at most 5 images. I am using this

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

with On Activity Result.

Min Khant Lu
  • 712
  • 1
  • 9
  • 20
  • so keep track of how many images they have uploaded – tyczj Jul 12 '17 at 14:48
  • Nah, i wanna let them select multiple image up to 5 at once. I mean they can select 5 photo image at once but cant select 6. – Min Khant Lu Jul 12 '17 at 14:52
  • 1
    You can't enforce that through 3rd party apps because you don't know which app will be chosen. You'd have to make your own picker or tell them that 5 is too much. – DeeV Jul 12 '17 at 14:57
  • Possible duplicate of [How to take multiple photos before dismissing camera intent?](https://stackoverflow.com/questions/8647371/how-to-take-multiple-photos-before-dismissing-camera-intent) – narancs Jul 12 '17 at 14:59
  • Thanks all. Guess I have to make only like what you guy advice – Min Khant Lu Jul 12 '17 at 15:01

1 Answers1

0

Well more code would be nice, but if I were you I would add the following basic solution: create an ArrayList of Images and store those.

List<Bitmap> uploadedImageList = new ArrayList<>();

in the onActivitResult():

if(resultCode == RESULT_OK
   && requestCode == yourRequestCode){
  //transform to bitmap
  //add bitmap to your list
  }

thank you can use if(arrayList.size() == 5){...do whatever...}

UPDATE I think I miss read the question, he wants user to upload 5 images at one: How to take multiple photos before dismissing camera intent?

narancs
  • 5,234
  • 4
  • 41
  • 60