Example usage for android.os Bundle putString

List of usage examples for android.os Bundle putString

Introduction

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

Prototype

public void putString(@Nullable String key, @Nullable String value) 

Source Link

Document

Inserts a String value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:Main.java

public static Bundle getStringAsBundle(String message) {
    Bundle b = new Bundle();
    b.putString("message", message);
    return b;//from   w  w  w .  ja  va  2s  .  c  om
}

From source file:Main.java

public static void putDataIntoIntent(Intent intent, String str) {
    Bundle bundle = new Bundle();
    bundle.putString("data", str);
    intent.putExtra("data", bundle);
}

From source file:Main.java

public static void start(Context context, Class<? extends Activity> clazz, String arg1) {
    Intent intent = new Intent(context, clazz);
    Bundle bundle = new Bundle();
    bundle.putString(ARG_1, arg1);
    intent.putExtras(bundle);/*from  w  ww  .  j av  a  2 s  . c om*/
    context.startActivity(intent);
}

From source file:Main.java

public static Intent gotoIntent_WithString(Context context, Class c, String accessName, String value) {
    Bundle bundle = new Bundle();
    bundle.putString(accessName, value);
    Intent intent = new Intent();
    intent.setClass(context, c);/*from   ww w .j  a v a 2 s .  com*/
    //intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtras(bundle);
    return intent;
}

From source file:Main.java

public static void putString(Fragment fragment, String key, String value) {
    Bundle args = getArguments(fragment);
    args.putString(key, value);
    fragment.setArguments(args);/* www  . j a  va2  s. co m*/
}

From source file:Main.java

private static Bundle createNamePortBundle(String name, int port, TreeMap<String, ArrayList<String>> ips) {
    Bundle namePort = new Bundle();
    namePort.putString("name", name);
    namePort.putInt("port", port);
    if (ips != null) {
        ArrayList<String> ip = ips.get(name);
        Collections.shuffle(ip, new Random());
        namePort.putString("ip", ip.get(0));
    }/* ww w .  ja v a  2s  .c  om*/
    return namePort;
}

From source file:Main.java

/**
 * Create a Parcelable Bundle containing a String message for transport to the test package engine.
 * The String message is stored via Bundle.putString using {@link #BUNDLE_MESSAGE} as the key for the item. 
 * @param message to send across processes.
 * @return Parcelable Bundle/*www .ja v  a  2s .c om*/
 * @see Bundle#putString(String, String)
 * @see Bundle#getString(String) 
 */
public static Parcelable setParcelableMessage(String message) {
    Bundle bundle = new Bundle();
    bundle.putString(BUNDLE_MESSAGE, message);
    bundle.setClassLoader(Bundle.class.getClassLoader());
    return bundle;
}

From source file:Main.java

public static Bundle createBundle(final String key, final String value) {
    final Bundle bundle = new Bundle();
    bundle.putString(key, value);
    return bundle;
}

From source file:Main.java

public static void launchActivity(Context context, Class<?> activity, String key, String value) {
    Bundle bundle = new Bundle();
    bundle.putString(key, value);
    launchActivity(context, activity, bundle);
}

From source file:Main.java

/**
 * Registers a file provider.// w  ww  .  j  a va 2s  .  c o m
 * 
 * @param id
 *            the provider ID. It should be a UUID.
 * @param authority
 *            the autority.
 */
public static void registerProviderInfo(String id, String authority) {
    Bundle bundle = new Bundle();
    bundle.putString(COLUMN_AUTHORITY, authority);
    MAP_PROVIDER_INFO.put(id, bundle);
}