Example usage for android.os Bundle getInt

List of usage examples for android.os Bundle getInt

Introduction

In this page you can find the example usage for android.os Bundle getInt.

Prototype

public int getInt(String key) 

Source Link

Document

Returns the value associated with the given key, or 0 if no mapping of the desired type exists for the given key.

Usage

From source file:Main.java

public static int getInt(Bundle b) {
    return b.getInt(INT_ARG);
}

From source file:Main.java

public static long getLong(Bundle b) {
    return b.getInt(LONG_ARG);
}

From source file:Main.java

public static long getLong2(Bundle b) {
    return b.getInt(LONG_ARG2);
}

From source file:Main.java

public static int getInt2(Bundle b) {
    return b.getInt(INT_ARG2);
}

From source file:Main.java

/**
 * Extract a int received from the test package engine.
 * The int message is extracted via Bundle.getCharArray using {@link #BUNDLE_SMALL_PARCEL_INDEX} as the key for the item. 
 * // w w w  .  j a v  a 2s .  c  o  m
 * @param Parcelable Bundle received from the test package engine
 * @return int represents the index of a parcel of a whole message, generated at the engine side.
 * @see Bundle#putCharArray(String, char[])
 * @see Bundle#getCharArray(String)
 * @see #setBundleOfSmallParcel(String, int, int)
 */
public static int getParcelableIndexFromSmallParcel(Parcelable parcelable) {
    Bundle bundle = (Bundle) parcelable;
    return bundle.getInt(BUNDLE_SMALL_PARCEL_INDEX);
}

From source file:Main.java

/**
 * Extract an int received from the test package engine.
 * The int message is extracted via Bundle.getCharArray using {@link #BUNDLE_SMALL_PARCEL_TOTALNUMBER} as the key for the item. 
 * /*from w  w w  .  j  av a  2 s .  c  o  m*/
 * @param Parcelable Bundle received from the test package engine
 * @return int the total number of parcels to be sent for one message, generated at the engine side.
 * @see Bundle#putCharArray(String, char[])
 * @see Bundle#getCharArray(String)
 * @see #setBundleOfSmallParcel(String, int, int)
 */
public static int getParcelableTotalNumberFromSmallParcel(Parcelable parcelable) {
    Bundle bundle = (Bundle) parcelable;
    return bundle.getInt(BUNDLE_SMALL_PARCEL_TOTALNUMBER);
}

From source file:Main.java

private static Integer getInteger(Bundle icicle, String key) {
    return icicle.containsKey(key) ? icicle.getInt(key) : null;
}

From source file:Main.java

public static int getTopicId(Bundle bundle, String inputValue) {
    int id = 0;/*from  w  w w . ja v a2  s . com*/
    if (bundle != null) {
        id = bundle.getInt(inputValue);
    }
    return id;
}

From source file:Main.java

public static Integer getInt(Bundle arguments, String key) {
    if (arguments.containsKey(key)) {
        return arguments.getInt(key);
    } else {//from   w  ww.jav  a2s.  c  om
        return null;
    }
}

From source file:Main.java

/**
 * Retrieves int value from bundle if present.
 *
 * @param bundle to get from//from  w  ww.j a  v a  2 s . c  o  m
 * @param key    to search by
 * @return value or {@link #DEFAULT_INT_VALUE} if nothing found
 */
public static int getInt(Bundle bundle, String key) {
    if (bundle != null && bundle.containsKey(key)) {
        return bundle.getInt(key);
    } else {
        return DEFAULT_INT_VALUE;
    }
}