Code example for Parcel

Methods: readBooleanArray, readByte, readInt, readLong, readString

0
        nativeVal1 = null;
        nativeVal2 = null;
        nativeVal3 = null;
 
        boolean[] validDataList = new boolean[MemberData.values().length];
        in.readBooleanArray(validDataList);
 
        if (validDataList[MemberData.LOCAL_DETAIL_ID.ordinal()]) {
            localDetailID = in.readLong(); // Primary key in database
        } 
 
        if (validDataList[MemberData.LOCAL_CONTACT_ID.ordinal()]) {
            localContactID = in.readLong();
        } 
 
        if (validDataList[MemberData.KEY.ordinal()]) {
            key = DetailKeys.values()[in.readInt()];
        } 
 
        if (validDataList[MemberData.KEY_TYPE.ordinal()]) {
            keyType = DetailKeyTypes.values()[in.readInt()];
        } 
 
        if (validDataList[MemberData.VALUE.ordinal()]) {
            value = in.readString();
        } 
 
        if (validDataList[MemberData.DELETED.ordinal()]) {
            deleted = (in.readByte() == 0 ? false : true);
        } 
 
        if (validDataList[MemberData.UPDATED.ordinal()]) {
            updated = in.readLong();
        } 
 
        if (validDataList[MemberData.UNIQUE_ID.ordinal()]) {
            unique_id = in.readLong();
        } 
 
        if (validDataList[MemberData.ORDER.ordinal()]) {
            order = in.readInt();
        } 
 
        if (validDataList[MemberData.LOCATION.ordinal()]) {
            location = Location.CREATOR.createFromParcel(in);
        } 
 
        if (validDataList[MemberData.ALT.ordinal()]) {
            alt = in.readString();
        } 
 
        if (validDataList[MemberData.PHOTO.ordinal()]) {
            photo = Bitmap.CREATOR.createFromParcel(in);
        } 
 
        if (validDataList[MemberData.PHOTO_MIME_TYPE.ordinal()]) {
            photo_mime_type = in.readString();
        } 
 
        if (validDataList[MemberData.PHOTO_URL.ordinal()]) {
            photo_url = in.readString();
        } 
 
        if (validDataList[MemberData.SERVER_CONTACT_ID.ordinal()]) {
            serverContactId = in.readLong();
        } 
 
        if (validDataList[MemberData.NATIVE_CONTACT_ID.ordinal()]) {
            nativeContactId = in.readInt();
        } 
 
        if (validDataList[MemberData.NATIVE_DETAIL_ID.ordinal()]) {
            nativeDetailId = in.readInt();
        } 
 
        if (validDataList[MemberData.NATIVE_VAL1.ordinal()]) {
            nativeVal1 = in.readString();
        } 
 
        if (validDataList[MemberData.NATIVE_VAL2.ordinal()]) {
            nativeVal2 = in.readString();
        } 
 
        if (validDataList[MemberData.NATIVE_VAL3.ordinal()]) {
            nativeVal3 = in.readString();
        } 
    } 
 
    /** {@inheritDoc} */ 
    @Override