Android: How to make List<List<String>> parcelable in a model

Viewed 42

I have a model User implements Parcelable which contains a field List<List<String>> segments. How to read and write this type of data in Parcel ?

1 Answers

I wrote this in my constructor

segments = in.readArrayList(FlightSegment.class.getClassLoader());

and this below code in writeToParcel

dest.writeList(segments);

Data is passing successfully now.

Related