Code example for Parcel

Methods: writeLong, writeString

0
        return "From: " + mFrom.getScreenName() + " To: " + mTo.getScreenName()
                + " " + mBody;
    } 
 
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(mId);
        AddressParcelHelper.writeToParcel(dest, mFrom);
        AddressParcelHelper.writeToParcel(dest, mTo);
        dest.writeString(mBody);
        dest.writeLong(mDate == null ? -1 : mDate.getTime());
    } 
 
    public int describeContents() { 
        return 0; 
    } 
 
    public static final Parcelable.Creator<Message> CREATOR = new Parcelable.Creator<Message>() {
        public Message createFromParcel(Parcel source) { 
            return new Message(source); 
        }