0

enter image description here

While trying to get multiple selected images from gallery, there is a compatible issue as shown in screenshot when i use image array list. What could be the solution?

 @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {

        super.onActivityResult(requestCode, resultCode, data);


        if (resultCode != RESULT_OK)
            return;
        if (requestCode == ConstantsCustomGallery.REQUEST_CODE && resultCode == Activity.RESULT_OK && data != null) {
            //The array list has the image paths of the selected images
            ArrayList<Image> images = data.getParcelableArrayListExtra(ConstantsCustomGallery.INTENT_EXTRA_IMAGES);


            for (int i = 0; i < images.size(); i++) {
                Uri uri = Uri.fromFile(new File(images.get(i).path));
                // start play with image uri

            }
techno
  • 47
  • 1
  • 7
  • 1
    Are you using any library as Image Picker ? Because ``Image` class does not implements `Parcelable`. Make the right Import and you will be good to go . – ADM Sep 17 '20 at 15:01
  • @ADM, Yes, i am using lib. But this is the syntax they have given., https://android-arsenal.com/details/1/5410 – techno Sep 17 '20 at 15:04

1 Answers1

1

As i said in comments You need to import the right Image .

import in.myinnos.awesomeimagepicker.models.Image;

instead of

import android.media.Image;
ADM
  • 20,406
  • 11
  • 52
  • 83