Code example for Parcel

Methods: static TextUtils.writeToParcel, writeBundle, writeByte, writeDouble, writeFloat, writeInt, writeLong, writeString

0
                   break; 
           } 
       } 
 
       public void writeToParcel(Parcel out, int flags) {
           out.writeInt(getTag());
           out.writeInt(this.viewId);
           out.writeString(this.methodName);
           out.writeInt(this.type);
           writeValue(out, flags);
       } 
        
       protected int getTag() { 
    	   return TAG;
       } 
        
       protected void writeValue(Parcel out, int flags) {
           switch (this.type) {
               case BOOLEAN:
                   out.writeInt((Boolean) this.value ? 1 : 0);
                   break; 
               case BYTE:
                   out.writeByte((Byte) this.value);
                   break; 
               case SHORT:
                   out.writeInt((Short) this.value);
                   break; 
               case INT:
                   out.writeInt((Integer) this.value);
                   break; 
               case LONG:
                   out.writeLong((Long) this.value);
                   break; 
               case FLOAT:
                   out.writeFloat((Float) this.value);
                   break; 
               case DOUBLE:
                   out.writeDouble((Double) this.value);
                   break; 
               case CHAR:
                   out.writeInt((int)((Character)this.value).charValue());
                   break; 
               case STRING:
                   out.writeString((String)this.value);
                   break; 
               case CHAR_SEQUENCE:
                   TextUtils.writeToParcel((CharSequence)this.value, out, flags);   
                   break; 
               case URI:
                   ((Uri)this.value).writeToParcel(out, flags);
                   break; 
               case BITMAP:
                   ((Bitmap)this.value).writeToParcel(out, flags);
                   break; 
               case BUNDLE:
                   out.writeBundle((Bundle) this.value);
                   break; 
               default: 
                   break; 
           } 
       }