Example usage for android.os Bundle putInt

List of usage examples for android.os Bundle putInt

Introduction

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

Prototype

public void putInt(@Nullable String key, int value) 

Source Link

Document

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

Usage

From source file:Main.java

public static Bundle createArguments(int dialogType, int appNameResId) {
    Bundle args = new Bundle();
    args.putInt(ARGUMENT_APP_NAME, appNameResId);
    args.putInt(ARGUMENT_DIALOG_TYPE, dialogType);
    return args;/*from w  ww . j  a v  a2s  .c  o m*/
}

From source file:Main.java

public static void setSelectedIndex(Bundle bundle, int selectedIndex) {
    bundle.putInt(ARG_SELECTED_INDEX, selectedIndex);
}

From source file:Main.java

public static Bundle create(int selectedZenMode) {
    Bundle bundle = new Bundle();
    bundle.putInt(EXTRA_ZEN_MODE, selectedZenMode);

    return bundle;
}

From source file:Main.java

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

From source file:Main.java

public static void sendMessageHandler(Handler handler, int what, String key, int value) {
    Message message = new Message();
    message.what = what;//  w ww.  j  a  v a 2s  . co  m
    Bundle bundle = new Bundle();
    bundle.putInt(key, value);
    message.setData(bundle);
    handler.sendMessage(message);
}

From source file:com.manning.androidhacks.hack047.fragments.ColorFragment.java

public static ColorFragment newInstance(int color, String text) {
    final ColorFragment fragment = new ColorFragment();

    Bundle args = new Bundle();
    args.putInt(COLOR_KEY, color);/*w  w  w .j  a v a  2s .  c om*/
    args.putString(TEXT_KEY, text);

    fragment.setArguments(args);

    return fragment;
}

From source file:Main.java

private static void putInteger(Bundle icicle, String key, Integer value) {
    if (value != null)
        icicle.putInt(key, value);
}

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

From source file:com.manning.androidhacks.hack029.fragment.ColorFragment.java

public static ColorFragment newInstance(int color, String text, boolean isLandscape) {
    ColorFragment recreateFragment = new ColorFragment();

    Bundle args = new Bundle();
    args.putInt(COLOR_KEY, color);/*from ww w  . j a  v a2 s .c  o  m*/
    args.putString(TEXT_KEY, text);
    args.putBoolean(LANDSCAPE_KEY, isLandscape);

    recreateFragment.setArguments(args);

    return recreateFragment;
}

From source file:Main.java

public static void addIfNotNull(Bundle b, String key, Integer value) {
    if (value != null) {
        b.putInt(key, value);
    }// w w  w . j  ava 2 s  . c  o m
}