Code example for Parcel

Methods: writeByte, writeInt, writeLong, writeString

0
    } 
 
    /** {@inheritDoc} */ 
    @Override 
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(mOption.ordinal());
        switch (mOption.getType()) {
            case BOOLEAN:
                dest.writeByte((byte)(((Boolean)mValue) ? 1 : 0));
                break; 
            case STRING:
                dest.writeString((String)mValue);
                break; 
            case INTEGER:
                dest.writeInt((Integer)mValue);
                break; 
            case LONG:
                dest.writeLong((Long)mValue);
                break; 
            default: 
                break; 
        } 
    }