I've found a few topics about making Path
a Serializable
object but I couldn't find anything about making it Parcelable
. From what I've read, Parcelable
objects are more efficient for packing and unpacking in a Bundle
.
I've made a new object called ParcelablePath
, which extends 'Path' and implements Parcelable
and have overridden the required methods, but I'm not really sure what to do in the overridden methods.
My question is, is it even possible to make Path
a Parcelable
object? If so how can I do it?
Here is some sample code:
public class ParcelablePath extends Path implements Parcelable {
protected ParcelablePath(Parcel in) {
}
public static final Creator<ParcelablePath> CREATOR = new Creator<ParcelablePath>() {
@Override
public ParcelablePath createFromParcel(Parcel in) {
return new ParcelablePath(in);
}
@Override
public ParcelablePath[] newArray(int size) {
return new ParcelablePath[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
}
}