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.ovrhere.android.careerstack.ui.MainActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putStringArrayList(KEY_FRAG_TAG_TACK, fragTagStack.getArrayList());
    outState.putSerializable(KEY_FRAG_SAVED_STATES, fragSavedStates);
    outState.putString(KEY_ACTIONBAR_TITLE, actionBarTitle);

    outState.putBundle(KEY_CURRENT_SEARCH_BAR_STATE, currSearchBarState);
}

From source file:br.liveo.navigationliveo.NavigationLiveoAWizard.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    // TODO Auto-generated method stub      
    super.onSaveInstanceState(outState);
    outState.putInt(CURRENT_POSITION, mCurrentPosition);

    //FORM WIZARD
    outState.putBundle("model", mWizardModel.save());
    outState.putBoolean("dataChanged", mDataChanged);
}

From source file:com.folioreader.ui.folio.activity.FolioActivity.java

/**
 * If called, this method will occur after onStop() for applications targeting platforms
 * starting with Build.VERSION_CODES.P. For applications targeting earlier platform versions
 * this method will occur before onStop() and there are no guarantees about whether it will
 * occur before or after onPause()/*from  ww  w.  j a  v  a 2  s  .  c o m*/
 *
 * @see Activity#onSaveInstanceState(Bundle) of Build.VERSION_CODES.P
 */
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    Log.v(LOG_TAG, "-> onSaveInstanceState");
    this.outState = outState;

    outState.putBoolean(BUNDLE_DISTRACTION_FREE_MODE, distractionFreeMode);
    outState.putBundle(SearchAdapter.DATA_BUNDLE, searchAdapterDataBundle);
    outState.putCharSequence(SearchActivity.BUNDLE_SAVE_SEARCH_QUERY, searchQuery);
}

From source file:com.eleybourn.bookcatalogue.BookEdit.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    Tracker.enterOnSaveInstanceState(this);
    super.onSaveInstanceState(outState);

    ActionBar actionBar = this.getSupportActionBar();

    outState.putLong(CatalogueDBAdapter.KEY_ROWID, mRowId);
    outState.putBundle("bookData", mBookData.getRawData());
    if (mList != null) {
        outState.putInt("FlattenedBooklistPosition", (int) mList.getPosition());
    }//from  w  w w .j  a  va 2s  . com
    outState.putInt(BookEdit.TAB, actionBar.getSelectedNavigationIndex());
    Tracker.exitOnSaveInstanceState(this);
}

From source file:com.facebook.samples.booleanog.LogicActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    uiHelper.onSaveInstanceState(outState);

    outState.putInt(SAVE_LEFT_OPERAND_SELECTION, leftSpinner.getSelectedItemPosition());
    outState.putInt(SAVE_RIGHT_OPERAND_SELECTION, rightSpinner.getSelectedItemPosition());
    outState.putInt(SAVE_CONTENT_SELECTION, contentSpinner.getSelectedItemPosition());
    outState.putString(SAVE_RESULT_TEXT, resultText.getText().toString());
    outState.putString(SAVE_POST_RESULT_TEXT, postResultText.getText().toString());
    outState.putString(SAVE_ACTIVE_TAB, activeTab);
    outState.putBundle(SAVE_PENDING, pendingPost);
    outState.putParcelableArrayList(SAVE_FRIEND_ACTIONS, friendActionList);
}

From source file:bolts.AppLinkNavigation.java

/**
 * Creates a bundle containing the final, constructed App Link data to be used in navigation.
 *///from   w  w w .j  a  v a 2  s.  co  m
private Bundle buildAppLinkDataForNavigation(Context context) {
    Bundle data = new Bundle();
    Bundle refererAppLinkData = new Bundle();
    if (context != null) {
        String refererAppPackage = context.getPackageName();
        if (refererAppPackage != null) {
            refererAppLinkData.putString(KEY_NAME_REFERER_APP_LINK_PACKAGE, refererAppPackage);
        }
        ApplicationInfo appInfo = context.getApplicationInfo();
        if (appInfo != null) {
            String refererAppName = context.getString(appInfo.labelRes);
            if (refererAppName != null) {
                refererAppLinkData.putString(KEY_NAME_REFERER_APP_LINK_APP_NAME, refererAppName);
            }
        }
    }
    data.putAll(getAppLinkData());
    data.putString(AppLinks.KEY_NAME_TARGET, getAppLink().getSourceUrl().toString());
    data.putString(KEY_NAME_VERSION, VERSION);
    data.putString(KEY_NAME_USER_AGENT, "Bolts Android " + Bolts.VERSION);
    data.putBundle(KEY_NAME_REFERER_APP_LINK, refererAppLinkData);
    data.putBundle(AppLinks.KEY_NAME_EXTRAS, getExtras());
    return data;
}

From source file:org.cobaltians.cobalt.activities.CobaltActivity.java

/***********************************************************************************************
 *
 * LIFECYCLE/*from ww w.  j ava  2s. c om*/
 *
 **********************************************************************************************/

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(getLayoutToInflate());
    sActivitiesArrayList.add(this);

    Bundle bundle = getIntent().getExtras();
    if (bundle == null) {
        bundle = new Bundle();
    }
    Bundle extras = bundle.getBundle(Cobalt.kExtras);
    if (extras == null) {
        extras = Cobalt.getInstance(this.getApplicationContext())
                .getConfigurationForController(getInitController());
        extras.putString(Cobalt.kPage, getInitPage());
        bundle.putBundle(Cobalt.kExtras, extras);
    }

    if (bundle.containsKey(Cobalt.kJSData)) {
        try {
            mDataNavigation = new JSONObject(bundle.getString(Cobalt.kJSData));
        } catch (JSONException e) {
            if (Cobalt.DEBUG)
                Log.e(Cobalt.TAG, TAG + " - onCreate: data navigation parsing failed. "
                        + extras.getString(Cobalt.kJSData));
            e.printStackTrace();
        }
    }

    if (extras.containsKey(Cobalt.kBars)) {
        try {
            JSONObject actionBar = new JSONObject(extras.getString(Cobalt.kBars));
            setupBars(actionBar);
        } catch (JSONException exception) {
            setupBars(null);
            if (Cobalt.DEBUG) {
                Log.e(Cobalt.TAG, TAG + " - onCreate: bars configuration parsing failed. "
                        + extras.getString(Cobalt.kBars));
            }
            exception.printStackTrace();
        }
    } else {
        setupBars(null);
    }

    if (savedInstanceState == null) {
        CobaltFragment fragment = getFragment();

        if (fragment != null) {
            fragment.setArguments(extras);
            mAnimatedTransition = bundle.getBoolean(Cobalt.kJSAnimated, true);

            if (mAnimatedTransition) {
                mWasPushedAsModal = bundle.getBoolean(Cobalt.kPushAsModal, false);
                if (mWasPushedAsModal) {
                    sWasPushedFromModal = true;
                    overridePendingTransition(R.anim.modal_open_enter, android.R.anim.fade_out);
                } else if (bundle.getBoolean(Cobalt.kPopAsModal, false)) {
                    sWasPushedFromModal = false;
                    overridePendingTransition(android.R.anim.fade_in, R.anim.modal_close_exit);
                } else if (sWasPushedFromModal)
                    overridePendingTransition(R.anim.modal_push_enter, R.anim.modal_push_exit);
            } else
                overridePendingTransition(0, 0);
        }

        if (findViewById(getFragmentContainerId()) != null) {
            getSupportFragmentManager().beginTransaction().replace(getFragmentContainerId(), fragment).commit();
        } else if (Cobalt.DEBUG)
            Log.e(Cobalt.TAG, TAG + " - onCreate: fragment container not found");
    } else if (Cobalt.DEBUG)
        Log.e(Cobalt.TAG, TAG + " - onCreate: getFragment() returned null");
}

From source file:com.facebook.Session.java

/**
 * Save the Session object into the supplied Bundle. This method is intended to be called from an
 * Activity or Fragment's onSaveInstanceState method in order to preserve Sessions across Activity lifecycle events.
 *
 * @param session the Session to save//  ww w .j a va  2 s  .c om
 * @param bundle  the Bundle to save the Session to
 */
public static final void saveSession(Session session, Bundle bundle) {
    if (bundle != null && session != null && !bundle.containsKey(SESSION_BUNDLE_SAVE_KEY)) {
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        try {
            new ObjectOutputStream(outputStream).writeObject(session);
        } catch (IOException e) {
            throw new FacebookException("Unable to save session.", e);
        }
        bundle.putByteArray(SESSION_BUNDLE_SAVE_KEY, outputStream.toByteArray());
        bundle.putBundle(AUTH_BUNDLE_SAVE_KEY, session.authorizationBundle);
    }
}

From source file:org.cobaltians.cobalt.fragments.CobaltFragment.java

protected void setBars(final JSONObject actionBar) {
    if (mContext != null) {
        Intent intent = ((CobaltActivity) mContext).getIntent();
        Bundle bundle = intent.getExtras();
        if (bundle == null) {
            bundle = new Bundle();
        }//from ww  w . j  a  v  a 2  s. co  m
        Bundle extras = bundle.getBundle(Cobalt.kExtras);
        if (extras == null) {
            extras = new Bundle();
            bundle.putBundle(Cobalt.kExtras, extras);
        }

        extras.putString(Cobalt.kBars, actionBar.toString());
        intent.putExtras(bundle);

        ((CobaltActivity) mContext).runOnUiThread(new Runnable() {
            @Override
            public void run() {
                ((CobaltActivity) mContext).setupBars(actionBar);
                ((CobaltActivity) mContext).supportInvalidateOptionsMenu();
            }
        });
    }
}

From source file:androidx.media.MediaController2.java

/**
 * Updates the playlist metadata/*from  ww w.  j a  v a2s  .  c o m*/
 *
 * @param metadata metadata of the playlist
 */
public void updatePlaylistMetadata(@Nullable MediaMetadata2 metadata) {
    Bundle args = new Bundle();
    args.putBundle(ARGUMENT_PLAYLIST_METADATA, metadata == null ? null : metadata.toBundle());
    sendCommand(COMMAND_CODE_PLAYLIST_SET_LIST_METADATA, args);
}