Example usage for android.os Parcel writeDouble

List of usage examples for android.os Parcel writeDouble

Introduction

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

Prototype

public final void writeDouble(double val) 

Source Link

Document

Write a double precision floating point value into the parcel at the current dataPosition(), growing dataCapacity() if needed.

Usage

From source file:Main.java

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

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

From source file:org.opendatakit.database.queries.BindArgs.java

private static void marshallObject(Parcel out, Object toMarshall) {
    if (toMarshall == null) {
        out.writeInt(0);/*w ww  .jav a2  s. co m*/
    } 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.tigerpenguin.places.model.PlaceLocation.java

@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeDouble(latitude);
    dest.writeDouble(longitude);
}

From source file:com.eTilbudsavis.etasdk.model.Size.java

public void writeToParcel(Parcel dest, int flags) {
    dest.writeDouble(this.mFrom);
    dest.writeDouble(this.mTo);
}

From source file:com.eTilbudsavis.etasdk.model.Dimension.java

public void writeToParcel(Parcel dest, int flags) {
    dest.writeDouble(this.mWidth);
    dest.writeDouble(this.mHeight);
}

From source file:it_minds.dk.eindberetningmobil_android.models.GPSCoordinateModel.java

@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeDouble(this.Latitude);
    dest.writeDouble(this.Longitude);
    dest.writeByte(IsViaPoint ? (byte) 1 : (byte) 0);
}

From source file:com.playhaven.android.data.Reward.java

/**
 * Flatten this object in to a Parcel.//from  w w  w .  jav  a  2s . c o m
 *
 * @param dest The Parcel in which the object should be written.
 * @param flags Additional flags about how the object should be written. May be 0 or Parcel#PARCELABLE_WRITE_RETURN_VALUE.
 */
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeDouble(quantity);
    dest.writeDouble(receipt);
    dest.writeString(tag);
    dest.writeString(signature);
}

From source file:com.eTilbudsavis.etasdk.model.Pricing.java

public void writeToParcel(Parcel dest, int flags) {
    dest.writeDouble(this.mPrice);
    dest.writeValue(this.mPrePrice);
    dest.writeString(this.mCurrency);
}

From source file:com.eTilbudsavis.etasdk.model.Si.java

public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(this.mSymbol);
    dest.writeDouble(this.mFactor);
}

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);//from   ww  w  . j a va2 s .  c  o m
    } 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);
        }
    }
}