-1

In android I have an ArrayListas follows:

ArrayList<SinglePoint> pointlist = new ArrayList<SinglePoint>();

which I will with content. When I am finished with the current activity, I need to transmit this object pointlist to a new activity. I tried the following (as I have found in several SO answers):

intent.putParcelableArrayListExtra("pointlist", pointlist);

and in the new activity I have the line

ArrayList<SinglePoint> pointlist = (ArrayList<SinglePoint>)getIntent().getSerializableExtra("pointlist");

but for the second line I get the error

Error:(40, 56) error: incompatible types: ArrayList<SinglePoint> cannot be converted to ArrayList<? extends Parcelable>

How to fix that?

I also tried the suggestion here which also does not work.

And with the following code as suggested here

intent.putExtra("pointlist", pointlist);

and

ArrayList<SinglePoint> pointlist = (ArrayList<SinglePoint>)getIntent().getSerializableExtra("pointlist");

I get the error

java.lang.RuntimeException: Parcel: unable to marshal value com.impyiablue.checkpoint.tools.SinglePoint@2f4a7cec
Alex
  • 38,938
  • 74
  • 207
  • 406

1 Answers1

0

You only need to implement the Parcelable interface for SinglePoint

This could help AndroidParcelable

floydheld
  • 317
  • 2
  • 11