Example usage for android.os Bundle Bundle

List of usage examples for android.os Bundle Bundle

Introduction

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

Prototype

public Bundle() 

Source Link

Document

Constructs a new, empty Bundle.

Usage

From source file:Main.java

public static Bundle fromXml(XmlPullParser parser) {
    Bundle bundle = new Bundle();
    AttributeSet attr = Xml.asAttributeSet(parser);
    for (int i = 0; i < attr.getAttributeCount(); i++) {
        bundle.putString(attr.getAttributeName(i), attr.getAttributeValue(i));
    }/*from   ww  w  . j  av  a2  s .  c o m*/
    return bundle;
}

From source file:Main.java

public static Parcelable cloneParcelbleClass(@NonNull Parcelable orange) {
    Bundle bundle = new Bundle();
    bundle.putParcelable("clone", orange);
    return bundle.getParcelable("clone");
}

From source file:Main.java

public static Bundle getBundle(Bundle oldBundle, Bundle newBundle) {
    if (oldBundle == null) {
        if (newBundle == null) {
            return new Bundle();
        } else {//ww  w . j ava  2  s. c  o m
            return newBundle;
        }
    } else {
        if (newBundle == null) {
            return new Bundle();
        } else {
            oldBundle.putAll(newBundle);
            return oldBundle;
        }
    }
}

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 Bundle createBundle(final String key, final boolean value) {
    final Bundle bundle = new Bundle();
    bundle.putBoolean(key, value);/*from w  w  w  .  j  a v  a  2  s.  c o  m*/
    return bundle;
}

From source file:Main.java

public static Bundle toBundle(Map<String, ? extends Parcelable> input) {
    Bundle output = new Bundle();
    for (String key : input.keySet()) {
        output.putParcelable(key, input.get(key));
    }/*from   w w w . ja  v  a2s.  co m*/
    return output;
}

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);/* ww  w  . j av  a  2  s.c o  m*/
    //intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtras(bundle);
    return intent;
}

From source file:Main.java

public static Bundle bundleCalendar(Calendar cal) {
    Bundle args = new Bundle();
    if (cal == null)
        cal = Calendar.getInstance(Locale.getDefault());
    ;//w  w  w .j  av a 2 s .  c  o m
    args.putInt("year", cal.get(Calendar.YEAR));
    args.putInt("month", cal.get(Calendar.MONTH));
    args.putInt("day", cal.get(Calendar.DAY_OF_MONTH));
    args.putInt("hour", cal.get(Calendar.HOUR_OF_DAY));
    args.putInt("minute", cal.get(Calendar.MINUTE));
    return args;
}

From source file:Main.java

public static Bundle hashtableToBundle(Hashtable table) {
    Bundle bundle = new Bundle();

    Iterator iterator = table.keySet().iterator();
    String key;/*from  w w w. j a  v  a 2s .c  o  m*/
    Object val;
    while (iterator.hasNext()) {
        key = (String) iterator.next();
        val = table.get(key);
        if (val instanceof Integer) {
            bundle.putInt(key, (Integer) val);
        } else if (val instanceof String) {
            bundle.putString(key, (String) val);
        }
    }
    return bundle;

}

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 a  2s .c o m
}