I have this:
public double[][] mRoute;
and I need to have it be Parcelable, but I am not certain of the best way to do this.
It appears that turning it into a List and then writing that isn’t the right approach.
UPDATE:
This is what compiled from @yuku’s answer.
out.writeInt(mRoute.length); // store the length
for (int i = 0; i < mRoute.length; i++) {
out.writeInt(mRoute[i].length);
out.writeDoubleArray(mRoute[i]);
}
mRoute = new double[in.readInt()][];
for (int i = 0; i < mRoute.length; i++) {
mRoute[i] = new double[in.readInt()];
in.readDoubleArray(mRoute[i]);
}
I haven’t tried it, just got it to compile, which is a start.
You can’t make a double[][] a Parcelable, but you can create a class that implements Parcelable and contains that double[][].
on writeToParcel(Parcel dest), do:
on readFromParcel(Parcel in), do: