Example usage for android.os Parcel writeInt

List of usage examples for android.os Parcel writeInt

Introduction

In this page you can find the example usage for android.os Parcel writeInt.

Prototype

public final void writeInt(int val) 

Source Link

Document

Write an integer value into the parcel at the current dataPosition(), growing dataCapacity() if needed.

Usage

From source file:com.clover.sdk.v3.JsonParcelHelper.java

private static void writeValue(Parcel out, int flags, Object v) {
    if (v == null || v == JSONObject.NULL) {
        out.writeInt(VAL_NULL);
    } else {/*from ww w.ja v  a2 s  .  com*/
        Class<?> c = v.getClass();
        if (c == String.class) {
            out.writeInt(VAL_STRING);
            out.writeString((String) v);
        } else if (c == Long.class) {
            out.writeInt(VAL_LONG);
            out.writeLong((Long) v);
        } else if (c == Boolean.class) {
            out.writeInt(VAL_BOOLEAN);
            out.writeInt((Boolean) v ? 1 : 0);
        } else if (c == JSONObject.class) {
            out.writeInt(VAL_MAP);
            wrap((JSONObject) v).writeToParcel(out, flags);
        } else if (c == JSONArray.class) {
            out.writeInt(VAL_OBJECTARRAY);
            wrap((JSONArray) v).writeToParcel(out, flags);
        } else if (c == Double.class) {
            out.writeInt(VAL_DOUBLE);
            out.writeDouble((Double) v);
        } else if (c == Integer.class) {
            out.writeInt(VAL_INTEGER);
            out.writeInt((Integer) v);
        } else if (c == Float.class) {
            out.writeInt(VAL_FLOAT);
            out.writeFloat((Float) v);
        } else {
            throw new RuntimeException("Json: unable to marshal value " + v);
        }
    }
}

From source file:edu.umich.flowfence.common.TaintSet.java

public static void writeToParcel(TaintSet ts, Parcel dest, int flags) {
    if (ts == null) {
        dest.writeInt(-1);
    } else {//from  w w w  .ja v a 2 s . c  o m
        ts.writeToParcel(dest, flags);
    }
}

From source file:com.jungle.base.utils.MiscUtils.java

public static void writeBytesToParcel(Parcel dest, byte[] buff) {
    int len = buff != null ? buff.length : 0;
    dest.writeInt(len);
    if (len > 0) {
        dest.writeByteArray(buff);//from   w  w w  .  j a  v a2  s.  com
    }
}

From source file:com.tigerpenguin.places.model.OpeningHours.java

@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(openNow ? 1 : 0);
    dest.writeList(periods);
}

From source file:com.dwg.weibo.entity.Visible.java

@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(this.type);
    dest.writeInt(this.list_id);
}

From source file:com.vk.sdk.api.model.VKApiGetMessagesResponse.java

@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(this.count);
    dest.writeParcelable(this.items, flags);
}

From source file:com.patloew.navigationviewfragmentadapters.StateMap.java

@Override
public void writeToParcel(Parcel out, int flags) {
    out.writeInt(map.size());

    for (Map.Entry<String, Fragment.SavedState> e : map.entrySet()) {
        out.writeString(e.getKey());/*www  .j a  v a  2s. co m*/
        out.writeParcelable(e.getValue(), flags);
    }
}

From source file:com.vk.sdk.api.model.VKApiGetDialogResponse.java

@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(this.count);
    dest.writeInt(this.unread_dialogs);
    dest.writeParcelable(this.items, flags);
}

From source file:org.catnut.metadata.WeiboAPIError.java

@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(error_code);
    dest.writeString(request);/*from  ww w  .  j a va 2  s . c o  m*/
    dest.writeString(error);
}

From source file:com.vk.sdk.api.model.VKApiDialog.java

@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(this.unread);
    dest.writeParcelable(this.message, flags);
}