Example usage for android.os Parcel writeLong

List of usage examples for android.os Parcel writeLong

Introduction

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

Prototype

public final void writeLong(long val) 

Source Link

Document

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

Usage

From source file:Main.java

public static void writeDate(Parcel parcel, Date date) {
    if (date == null) {
        parcel.writeLong(Long.MIN_VALUE);
    } else {//from w w w.j a va  2  s .c o m
        parcel.writeLong(date.getTime());
    }
}

From source file:Main.java

/***********************************/

public static void writeLocation(Parcel dest, Location loc) {
    dest.writeString(loc.getProvider());
    dest.writeLong(loc.getTime());
    dest.writeDouble(loc.getLatitude());
    dest.writeDouble(loc.getLongitude());
    dest.writeDouble(loc.getAltitude());
    dest.writeFloat(loc.getAccuracy());//from  w  ww.  j ava  2s  . co  m
    dest.writeFloat(loc.getBearing());
    dest.writeFloat(loc.getSpeed());
}

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);/*  ww  w.  jav  a 2 s  . c  om*/
    } else {
        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:org.opendatakit.database.queries.BindArgs.java

private static void marshallObject(Parcel out, Object toMarshall) {
    if (toMarshall == null) {
        out.writeInt(0);//from w  w  w  . ja va 2 s  . c  om
    } else if (toMarshall instanceof String) {
        out.writeInt(1);
        out.writeString((String) toMarshall);
    } else if (toMarshall instanceof Integer) {
        out.writeInt(2);
        out.writeInt((Integer) toMarshall);
    } else if (toMarshall instanceof Boolean) {
        if ((Boolean) toMarshall) {
            out.writeInt(3);
        } else {
            out.writeInt(4);
        }
    } else if (toMarshall instanceof Double) {
        out.writeInt(5);
        out.writeDouble((Double) toMarshall);
    } else if (toMarshall instanceof Float) {
        out.writeInt(6);
        out.writeFloat((Float) toMarshall);
    } else if (toMarshall instanceof Long) {
        out.writeInt(7);
        out.writeLong((Long) toMarshall);
    } else {
        throw new IllegalStateException("should have been prevented in constructor");
    }
}

From source file:com.liferay.alerts.model.User.java

@Override
public void writeToParcel(Parcel parcel, int flags) {
    parcel.writeLong(_id);
    parcel.writeString(_uuid);/* www . j a va 2 s.co  m*/
    parcel.writeString(_fullName);
    parcel.writeLong(_portraitId);
}

From source file:us.dustinj.locationstore.Export.java

@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeLong(GetStartTime().getTime());
    dest.writeLong(GetDurationMs());//  w w w.  j ava2s  .  c o m
    dest.writeString(GetExportID());
}

From source file:com.nestapi.lib.API.AccessToken.java

@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(mToken);
    dest.writeLong(mExpiresIn);
}

From source file:com.artemchep.horario.database.models.SubjectTaskService.java

@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(key);/*  w  w  w .  j ava2 s .  c o  m*/
    dest.writeLong(timestamp);
    dest.writeLong(timestampEdited);
}

From source file:com.nestlabs.sdk.NestToken.java

@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(mToken);
    dest.writeLong(mExpiresInSecs);
}

From source file:com.nestlabs.sdk.Metadata.java

@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(mAccessToken);
    dest.writeLong(mClientVersion);
}