Code example for Parcel

Methods: readByteArray, readDouble, readInt, readLong, readParcelable, readString

0
	ACtxHistoryAttribute(final ACtxAttributeIdentifier attrId, 
			final Date lastModified, final Date lastUpdated,
			final String stringValue, final Integer integerValue,
			final Double doubleValue, final byte[] binaryValue,
			final CtxAttributeValueType valueType, final String valueMetric) {
		 
		super(attrId);
		super.setLastModified(lastModified);
		this.lastUpdated = lastUpdated;
		this.stringValue = stringValue;
		this.integerValue = integerValue;
		this.doubleValue = doubleValue;
		this.binaryValue = binaryValue;
		this.valueType = valueType;
		this.valueMetric = valueMetric;
	} 
	 
	/** 
	 * Making class Parcelable 
	 */ 
 
    public int describeContents() { 
        return 0; 
    } 
 
    public void writeToParcel(Parcel out, int flags) {
    	super.writeToParcel(out, flags);
    	out.writeLong(lastUpdated.getTime());
    	out.writeString(stringValue);
    	out.writeInt(integerValue);
    	out.writeDouble(doubleValue);
    	out.writeByteArray(binaryValue);
    	out.writeString((valueType == null) ? "" : valueType.name());
    	out.writeString(valueMetric);
    } 
 
    public static final Parcelable.Creator<ACtxHistoryAttribute> CREATOR = new Parcelable.Creator<ACtxHistoryAttribute>() {
        public ACtxHistoryAttribute createFromParcel(Parcel in) { 
            return new ACtxHistoryAttribute(in); 
        } 
 
        public ACtxHistoryAttribute[] newArray(int size) { 
            return new ACtxHistoryAttribute[size]; 
        } 
    }; 
        
    private ACtxHistoryAttribute(Parcel in) {
    	super(in);
//    	this.lastUpdated.setTime(in.readLong()); 
    	this.lastUpdated = new Date (in.readLong());
		this.stringValue = in.readString();
		this.integerValue = in.readInt();
		this.doubleValue = in.readDouble();
		this.binaryValue = new byte[in.readInt()];
		in.readByteArray(this.binaryValue);
		 
    	try { 
    		this.valueType = CtxAttributeValueType.valueOf(in.readString());
    	} catch (IllegalArgumentException x) {
    		this.valueType = null;
    	} 
    	 
		this.valueMetric = in.readString();
    } 
     
	/** 
	 *  
	 * @param attribute