Code example for Parcel

Methods: dataPosition, readInt, readString, setDataPosition

0
            return new ExtensionData[size]; 
        } 
    }; 
 
    private ExtensionData(Parcel in) {
        int parcelableVersion = in.readInt();
        int parcelableSize = in.readInt();
        int startPosition = in.dataPosition();
        if (parcelableVersion >= 1) {
            this.mVisible = (in.readInt() != 0);
            this.mIcon = in.readInt();
            this.mStatus = in.readString();
            if (TextUtils.isEmpty(this.mStatus)) {
                this.mStatus = null;
            } 
            this.mExpandedTitle = in.readString();
            if (TextUtils.isEmpty(this.mExpandedTitle)) {
                this.mExpandedTitle = null;
            } 
            this.mExpandedBody = in.readString();
            if (TextUtils.isEmpty(this.mExpandedBody)) {
                this.mExpandedBody = null;
            } 
            try { 
                this.mClickIntent = Intent.parseUri(in.readString(), 0);
            } catch (URISyntaxException ignored) {
            } 
        } 
        if (parcelableVersion >= 2) {
            this.mContentDescription = in.readString();
            if (TextUtils.isEmpty(this.mContentDescription)) {
                this.mContentDescription = null;
            } 
            String iconUriString = in.readString();
            this.mIconUri = TextUtils.isEmpty(iconUriString) ? null : Uri.parse(iconUriString);
        } 
        // Only advance the data position if the parcelable version is >= 2. In v1 of the 
        // parcelable, there was an awful bug where the parcelableSize was complete nonsense. 
        if (parcelableVersion >= 2) {
            in.setDataPosition(startPosition + parcelableSize);
        } 
    } 
 
    @Override 
    public void writeToParcel(Parcel parcel, int i) {