I have this ArrayList
private ArrayList<ArrayList<MyCustomObject>>schedule;
So each element of this array is another array list of my custom object
How would I go about writing this to parcel?
This is my initial approach but wondering if there is a clean and shorter way.
Writing to parcel
if(schedule != null){
dest.writeInt(schedule.size());
for (ArrayList<MyCustomObject> schedules : schedule) {
dest.writeTypedList(schedules);
}
}
Reading from parcel
int sizeOfSchedule = in.readInt();
schedule = new ArrayList<>();
for(int i = 0; i < sizeOfSchedule; i++){
schedule.add(in.createTypedArrayList(MyCustomObject.CREATOR));
}
UPDATED 1 : Tested the above and it works