Search code examples
javaandroidparcelable

Error: Required: Image, Found:Image & Parcelable


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

            }

Solution

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

    import in.myinnos.awesomeimagepicker.models.Image;
    

    instead of

    import android.media.Image;