Example usage for android.os Bundle getString

List of usage examples for android.os Bundle getString

Introduction

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

Prototype

@Nullable
public String getString(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:Main.java

public static String getStringFromBundle(Bundle b) {

    return b.getString("message");
}

From source file:Main.java

public static String getTag(Bundle b) {
    return b.getString(TAG_ARG);
}

From source file:Main.java

public static String getString(Bundle b) {
    return b.getString(STRING_ARG);
}

From source file:Main.java

public static String getString2(Bundle b) {
    return b.getString(STRING_ARG2);
}

From source file:Main.java

public static String getSwitchMessage(Intent intent) {
    Bundle bundle = intent.getExtras();
    return bundle.getString(KEY_SWITCH);
}

From source file:Main.java

/**
 * Extract the String message received from the test package engine.
 * The String message is retrieved via Bundle.getString using {@link #BUNDLE_MESSAGE} as the key for the item. 
 * @param Parcelable Bundle received from the TCP Messenger Service.
 * @return String message, if present/*from w  ww  .j a v  a2 s  . co  m*/
 * @see Bundle#putString(String, String)
 * @see Bundle#getString(String) 
 */
public static String getParcelableMessage(Parcelable parcelable) {
    Bundle bundle = (Bundle) parcelable;
    return bundle.getString(BUNDLE_MESSAGE);
}

From source file:Main.java

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

From source file:Main.java

public static String getDataFromIntent(Intent intent) {
    Bundle bundle = intent.getBundleExtra("data");
    String res = bundle.getString("data");
    ;/*  ww w  .j a v  a2s .c  o  m*/
    return res;
}

From source file:Main.java

public static long bundleGetStringLong(Bundle bundle, String key) {
    if (bundle == null)
        return -1;
    String s = bundle.getString(key);
    if (s == null)
        return -1;
    try {//from   w w  w. j a v  a2 s  .  c o  m
        return Long.parseLong(s);
    } catch (NumberFormatException e) {
        return -1;
    }
}

From source file:Main.java

/**
 * Used to get the parameter values passed into Activity via a Bundle.
 *
 * @return param Parameter value//  w  ww  .j a v  a 2 s  .  c  om
 */
public static String getExtraString(Activity context, String key) {
    String param = "";
    Bundle bundle = context.getIntent().getExtras();
    if (bundle != null) {
        param = bundle.getString(key);
    }
    return param;
}