Code example for Parcel

Methods: readByteArray, readInt

0
    //Static Methods 
    public static final Parcelable.Creator<SmsRawData> CREATOR
            = new Parcelable.Creator<SmsRawData> (){ 
        public SmsRawData createFromParcel(Parcel source) { 
            int size; 
            size = source.readInt(); 
            byte[] data = new byte[size]; 
            source.readByteArray(data); 
            return new SmsRawData(data); 
        } 
 
        public SmsRawData[] newArray(int size) { 
            return new SmsRawData[size]; 
        } 
    }; 
 
    // Constructor 
    public SmsRawData(byte[] data) {
        this.data = data;
    }