Example usage for android.os Parcel readString

List of usage examples for android.os Parcel readString

Introduction

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

Prototype

public final String readString() 

Source Link

Document

Read a string value from the parcel at the current dataPosition().

Usage

From source file:Main.java

public static String readString(Parcel in) {
    String val = in.readString();
    return TextUtils.isEmpty(val) || val.equals("null") ? null : val;
}

From source file:Main.java

public static Location readLocation(Parcel in) {
    Location loc = new Location(in.readString());
    loc.setTime(in.readLong());//www .j  av  a  2 s  . c  om
    loc.setLatitude(in.readDouble());
    loc.setLongitude(in.readDouble());
    loc.setAltitude(in.readDouble());
    loc.setAccuracy(in.readFloat());
    loc.setBearing(in.readFloat());
    loc.setSpeed(in.readFloat());
    return loc;
}

From source file:Main.java

public static String readStringFromParcel(Parcel in) {
    int flag = in.readInt();
    if (flag == 1) {
        return in.readString();
    } else {/*  ww  w .  j a  v  a  2  s  . com*/
        return null;
    }
}

From source file:Main.java

public static Map<String, String> readStringMap(Parcel parcel) {
    Map<String, String> map = null;
    int size = parcel.readInt();
    if (size > 0) {
        map = new HashMap<String, String>(size);
        for (int i = 0; i < size; i++) {
            String key = parcel.readString();
            String value = parcel.readString();
            map.put(key, value);/* w ww . j a  v a2 s . c  om*/
        }
    }
    return map;
}

From source file:Main.java

/**
 * Read a HashMap from a Parcel, class of key and value are both String
 * //  w w  w  .ja  v a  2 s. com
 * @param in
 * @return
 */
public static Map<String, String> readHashMapStringAndString(Parcel in) {
    if (in == null) {
        return null;
    }

    int size = in.readInt();
    if (size == -1) {
        return null;
    }

    Map<String, String> map = new HashMap<String, String>();
    for (int i = 0; i < size; i++) {
        String key = in.readString();
        map.put(key, in.readString());
    }
    return map;
}

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

private static Object unmarshallObject(Parcel in) {
    int dataType = in.readInt();
    switch (dataType) {
    case 0:/*from  w w  w .j  a  va 2s .  c o  m*/
        return null;
    case 1:
        return in.readString();
    case 2:
        return in.readInt();
    case 3:
        return Boolean.TRUE;
    case 4:
        return Boolean.FALSE;
    case 5:
        return in.readDouble();
    case 6:
        return in.readFloat();
    case 7:
        return in.readLong();
    default:
        throw new IllegalStateException("should have been prevented in constructor");
    }
}

From source file:com.philliphsu.clock2.alarms.Alarm.java

private static Alarm create(Parcel in) {
    Alarm alarm = Alarm.builder().hour(in.readInt()).minutes(in.readInt()).label(in.readString())
            .ringtone(in.readString()).vibrates(in.readInt() != 0).build();
    alarm.setId(in.readLong());//w w  w  . jav  a2  s.  c  om
    alarm.snoozingUntilMillis = in.readLong();
    alarm.enabled = in.readInt() != 0;
    in.readBooleanArray(alarm.recurringDays);
    alarm.ignoreUpcomingRingTime = in.readInt() != 0;
    return alarm;
}

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

private static Object readValue(Parcel in) {
    int type = in.readInt();

    switch (type) {
    case VAL_NULL:
        return JSONObject.NULL;

    case VAL_STRING:
        return in.readString();

    case VAL_INTEGER:
        return in.readInt();

    case VAL_MAP:
        return ObjectWrapper.CREATOR.createFromParcel(in).unwrap();

    case VAL_LONG:
        return in.readLong();

    case VAL_FLOAT:
        return in.readFloat();

    case VAL_DOUBLE:
        return in.readDouble();

    case VAL_BOOLEAN:
        return in.readInt() != 0;

    case VAL_OBJECTARRAY:
        return ArrayWrapper.CREATOR.createFromParcel(in).unwrap();

    default://from   w  w  w .  j a  va 2  s  .  c o  m
        int off = in.dataPosition() - 4;
        throw new IllegalArgumentException(
                "Json: unmarshalling unknown type code " + type + " at offset " + off);
    }
}

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

public static QMDescriptor readFromParcel(Parcel source) {
    int kind = source.readInt();
    if (kind == KIND_NULL) {
        return null;
    }//from w ww  .j a  v  a  2 s . co m

    ComponentName definingClass = new ComponentName(source);
    String methodName = source.readString();
    ArrayList<String> paramTypes = source.createStringArrayList();

    return new QMDescriptor(kind, definingClass, methodName, paramTypes, false);
}

From source file:edu.umich.oasis.common.SodaDescriptor.java

public static SodaDescriptor readFromParcel(Parcel source) {
    int kind = source.readInt();
    if (kind == KIND_NULL) {
        return null;
    }/*from  ww  w .  j  a  va2 s .  com*/

    ComponentName definingClass = new ComponentName(source);
    String methodName = source.readString();
    ArrayList<String> paramTypes = source.createStringArrayList();

    return new SodaDescriptor(kind, definingClass, methodName, paramTypes, false);
}