Can android.graphics.Path be made Parcelable?

I found some order on the establishment of the object Patha Serializable, but I found nothing about its creation Parcelable. From what I read, Parcelableobjects are more efficient for packing and unpacking in Bundle.

I created a new object with a name ParcelablePaththat extends the "Path" and implements Parcelableand overrides the required methods, but I'm not quite sure what to do in the overridden methods.

My question is: is it possible to make object Patha Parcelable? If so, how can I do this?

Here is a 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) {

    }
}
+4
1
-1

Source: https://habr.com/ru/post/1618913/


All Articles