Example usage for android.os Bundle putBundle

List of usage examples for android.os Bundle putBundle

Introduction

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

Prototype

public void putBundle(@Nullable String key, @Nullable Bundle value) 

Source Link

Document

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

Usage

From source file:com.zhongzilu.bit100.view.base.BaseStatedFragment.java

private void saveStateToArguments() {
    if (getView() != null)
        savedState = saveState();/*  w  ww .j  a  v  a  2s . c  om*/
    if (savedState != null) {
        Bundle b = getArguments();
        if (b != null) {
            b.putBundle(SAVE_KEY, savedState);
        }

    }
}

From source file:org.fs.ghanaian.util.JsonUtility.java

private static void putBundleObject(Bundle bundle, String key, Object object) {
    if (bundle != null && object != null && !TextUtils.isEmpty(key)) {
        if (object instanceof String) {
            bundle.putString(key, (String) object);
        } else if (object instanceof Boolean) {
            bundle.putBoolean(key, (Boolean) object);
        } else if (object instanceof Double) {
            bundle.putDouble(key, (Double) object);
        } else if (object instanceof Float) {
            Float value = (Float) object;

            bundle.putDouble(key, (double) value);
        } else if (object instanceof Integer) {
            bundle.putInt(key, (Integer) object);
        } else if (object instanceof Long) {
            bundle.putLong(key, (Long) object);
        } else if (object instanceof JSONObject) {
            object = parseBundle((JSONObject) object);

            bundle.putBundle(key, (Bundle) object);
        } else if (object instanceof JSONArray) {
            int elementQuantity = ((JSONArray) object).length();
            Bundle subBundle = new Bundle(elementQuantity);

            for (int i = 0; i < elementQuantity; i++) {
                Object subObject = getArrayValue((JSONArray) object, i, null);

                if (subObject != null) {
                    putBundleObject(subBundle, key, subObject);
                }/*from   www  . j a v a 2s  . c o  m*/
            }
        }
    }
}

From source file:com.google.android.apps.authenticator.dataexport.Exporter.java

public Bundle getData() {
    Bundle result = new Bundle();
    result.putBundle("accountDb", getAccountDbBundle(mAccountDb));
    if (mPreferences != null) {
        result.putBundle("preferences", getPreferencesBundle(mPreferences));
    }/*w w  w .  ja  va2  s. com*/
    return result;
}

From source file:com.github.nicktgn.mvp.MvpFragment.java

/**
 * Use this helper method to get another View (Fragment)
 * with extras containing provided arguments indented for Presenter of this new View
 * @param arguments arguments from this View's Presenter intended for Presenter of another View
 * @return intent to another View (Activity) (or null if failed to instantiate)
 *///from  www.  ja  v  a 2 s  . c o  m
protected <T extends MvpFragment> T getMvpFragment(Class<T> targetView, MvpBundle arguments) {
    try {
        T fragment = targetView.getConstructor().newInstance();
        Bundle bundle = new Bundle();
        bundle.putBundle(Constants.ARGUMENTS_DATA, arguments.getRealBundle());
        fragment.setArguments(bundle);
        return fragment;
    } catch (java.lang.InstantiationException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:com.pixplicity.wizardpager.wizard.model.AbstractWizardModel.java

public Bundle save() {
    Bundle bundle = new Bundle();
    for (Page page : getCurrentPageSequence()) {
        bundle.putBundle(page.getKey(), page.getData());
    }//from   w  w  w .  ja v  a  2  s  . c o m
    return bundle;
}

From source file:com.kogitune.activity_transition.fragment.FragmentTransitionLauncher.java

/**
 * You should call this method after init your argumentsBundle.otherwise the transitionBundle will be not work.
 *//*w  w  w . jav  a  2s.c  o m*/
public void prepare(Fragment toFragment) {
    final Bundle transitionBundle = TransitionBundleFactory.createTransitionBundle(context, fromView, bitmap);
    Bundle arguments = toFragment.getArguments();
    if (arguments == null) {
        arguments = new Bundle();
    }
    arguments.putBundle(TRANSITION_BUNDLE, transitionBundle);
    toFragment.setArguments(arguments);
}

From source file:com.kogitune.activity_transition.fragment.FragmentTransitionLauncher.java

/**
 * You should call this method after init your argumentsBundle.otherwise the transitionBundle will be not work.
 *///w w  w. ja  v a  2  s.c o m
public void prepare(android.support.v4.app.Fragment toFragment) {
    final Bundle transitionBundle = TransitionBundleFactory.createTransitionBundle(context, fromView, bitmap);
    Bundle arguments = toFragment.getArguments();
    if (arguments == null) {
        arguments = new Bundle();
    }
    arguments.putBundle(TRANSITION_BUNDLE, transitionBundle);
    toFragment.setArguments(arguments);
}

From source file:io.github.hidroh.materialistic.BaseListFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putBundle(STATE_ADAPTER, getAdapter().saveState());
}

From source file:com.btmura.android.reddit.app.SearchSubredditListController.java

@Override
public void saveInstanceState(Bundle outState) {
    outState.putString(EXTRA_SELECTED_SUBREDDIT, getSelectedSubreddit());
    outState.putBundle(EXTRA_CURSOR_EXTRAS, cursorExtras);
}

From source file:com.google.android.gcm.demo.ui.AbstractFragment.java

@Override
public void onSaveInstanceState(Bundle savedState) {
    super.onSaveInstanceState(savedState);
    savedState.putBundle(STATE_FRAGMENT, mFragmentState);
}