Code example for Parcel

Methods: readLong, readString

0
 
    public static final Parcelable.Creator<SimpleParcelable> CREATOR
        = new Parcelable.Creator<SimpleParcelable>() { 
            public SimpleParcelable createFromParcel(Parcel src) { 
                return new SimpleParcelable( 
                    src.readLong(), 
                    src.readString()); 
            } 
     
            public SimpleParcelable[] newArray(int size) { 
                return new SimpleParcelable[size]; 
            } 
        }; 
 
    private State state;
    private Date date;
 
    public SimpleParcelable(long date, String state) {
        if (0 <= date) { this.date = new Date(date); }
        if ((null != state) && (0 < state.length())) {
            this.state = unmarshalState.get(state);