Code example for Parcel

Methods: writeIntwriteParcelablewriteString

0
        return 0; 
    } 
 
    @Override 
    public void writeToParcel(Parcel out, int flags) {
        out.writeString(key);
        out.writeInt(state);
        out.writeParcelable(intent, flags);
    } 
 
    public static final Parcelable.Creator<LegacyVpnInfo> CREATOR =
            new Parcelable.Creator<LegacyVpnInfo>() { 
        @Override 
        public LegacyVpnInfo createFromParcel(Parcel in) { 
            LegacyVpnInfo info = new LegacyVpnInfo(); 
            info.key = in.readString(); 
            info.state = in.readInt(); 
            info.intent = in.readParcelable(null); 
            return info; 
        }