android.os.ParcelFormatException Java Examples

The following examples show how to use android.os.ParcelFormatException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: android_9.0.0_r45   Author: lulululbj   File: KeymasterArgument.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public KeymasterArgument createFromParcel(Parcel in) {
    final int pos = in.dataPosition();
    final int tag = in.readInt();
    switch (KeymasterDefs.getTagType(tag)) {
        case KeymasterDefs.KM_ENUM:
        case KeymasterDefs.KM_ENUM_REP:
        case KeymasterDefs.KM_UINT:
        case KeymasterDefs.KM_UINT_REP:
            return new KeymasterIntArgument(tag, in);
        case KeymasterDefs.KM_ULONG:
        case KeymasterDefs.KM_ULONG_REP:
            return new KeymasterLongArgument(tag, in);
        case KeymasterDefs.KM_DATE:
            return new KeymasterDateArgument(tag, in);
        case KeymasterDefs.KM_BYTES:
        case KeymasterDefs.KM_BIGNUM:
            return new KeymasterBlobArgument(tag, in);
        case KeymasterDefs.KM_BOOL:
            return new KeymasterBooleanArgument(tag, in);
        default:
            throw new ParcelFormatException("Bad tag: " + tag + " at " + pos);
    }
}
 
Example #2
Source Project: android_9.0.0_r45   Author: lulululbj   File: NetworkEvent.java    License: Apache License 2.0 5 votes vote down vote up
public NetworkEvent createFromParcel(Parcel in) {
    final int initialPosition = in.dataPosition();
    final int parcelToken = in.readInt();
    // we need to move back to the position from before we read parcelToken
    in.setDataPosition(initialPosition);
    switch (parcelToken) {
        case PARCEL_TOKEN_DNS_EVENT:
            return DnsEvent.CREATOR.createFromParcel(in);
        case PARCEL_TOKEN_CONNECT_EVENT:
            return ConnectEvent.CREATOR.createFromParcel(in);
        default:
            throw new ParcelFormatException("Unexpected NetworkEvent token in parcel: "
                    + parcelToken);
    }
}
 
Example #3
Source Project: StockChart-MPAndroidChart   Author: LambdaXiao   File: Entry.java    License: MIT License 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeFloat(this.x);
    dest.writeFloat(this.getY());
    if (getData() != null) {
        if (getData() instanceof Parcelable) {
            dest.writeInt(1);
            dest.writeParcelable((Parcelable) this.getData(), flags);
        } else {
            throw new ParcelFormatException("Cannot parcel an Entry with non-parcelable data");
        }
    } else {
        dest.writeInt(0);
    }
}
 
Example #4
Source Project: Ticket-Analysis   Author: xiaolongonly   File: Entry.java    License: MIT License 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeFloat(this.x);
    dest.writeFloat(this.getY());
    if (getData() != null) {
        if (getData() instanceof Parcelable) {
            dest.writeInt(1);
            dest.writeParcelable((Parcelable) this.getData(), flags);
        } else {
            throw new ParcelFormatException("Cannot parcel an Entry with non-parcelable data");
        }
    } else {
        dest.writeInt(0);
    }
}
 
Example #5
Source Project: android-kline   Author: VinsonGuo   File: Entry.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeFloat(this.x);
    dest.writeFloat(this.getY());
    if (getData() != null) {
        if (getData() instanceof Parcelable) {
            dest.writeInt(1);
            dest.writeParcelable((Parcelable) this.getData(), flags);
        } else {
            throw new ParcelFormatException("Cannot parcel an Entry with non-parcelable data");
        }
    } else {
        dest.writeInt(0);
    }
}
 
Example #6
Source Project: Stayfit   Author: rahulmaddineni   File: Entry.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeFloat(this.mVal);
    dest.writeInt(this.mXIndex);
    if (mData != null) {
        if (mData instanceof Parcelable) {
            dest.writeInt(1);
            dest.writeParcelable((Parcelable) this.mData, flags);
        } else {
            throw new ParcelFormatException("Cannot parcel an Entry with non-parcelable data");
        }
    } else {
        dest.writeInt(0);
    }
}
 
Example #7
Source Project: NetKnight   Author: pencil-box   File: Entry.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeFloat(this.mVal);
    dest.writeInt(this.mXIndex);
    if (mData != null) {
        if (mData instanceof Parcelable) {
            dest.writeInt(1);
            dest.writeParcelable((Parcelable) this.mData, flags);
        } else {
            throw new ParcelFormatException("Cannot parcel an Entry with non-parcelable data");
        }
    } else {
        dest.writeInt(0);
    }
}
 
Example #8
Source Project: JNChartDemo   Author: panyz   File: Entry.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeFloat(this.mVal);
    dest.writeInt(this.mXIndex);
    if (mData != null) {
        if (mData instanceof Parcelable) {
            dest.writeInt(1);
            dest.writeParcelable((Parcelable) this.mData, flags);
        } else {
            throw new ParcelFormatException("Cannot parcel an Entry with non-parcelable data");
        }
    } else {
        dest.writeInt(0);
    }
}