Code example for Parcel

Methods: writeIntwriteLongwriteSerializablewriteString

0
    public int describeContents() { 
        return 0; 
    } 
 
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(name);
        dest.writeString(description);
        dest.writeSerializable(due_time);
        if (has_due_time)
            dest.writeInt(1);
        else 
            dest.writeInt(0);
        dest.writeString(location_name);
        dest.writeInt(location.getLatitudeE6());
        dest.writeInt(location.getLongitudeE6());
        if (has_location)
            dest.writeInt(1);
        else 
            dest.writeInt(0);
        dest.writeLong(remind_time);
        dest.writeInt(remind_distance);
        dest.writeInt(task_id);
    } 
     
    public static final Parcelable.Creator<Task> CREATOR = new Parcelable.Creator<Task>() {
        public Task createFromParcel(Parcel in) { 
            return new Task(in);