Example usage for android.os Bundle putParcelable

List of usage examples for android.os Bundle putParcelable

Introduction

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

Prototype

public void putParcelable(@Nullable String key, @Nullable Parcelable value) 

Source Link

Document

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

Usage

From source file:ch.berta.fabio.popularmovies.presentation.ui.activities.MovieGridActivity.java

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

    outState.putParcelable(STATE_VIEW_MODEL, mViewModel);
    if (mUseTwoPane) {
        outState.putParcelable(STATE_VIEW_MODEL_DETAILS, mDetailsViewModel);
    }//w ww. java2 s . c om
}

From source file:com.artemchep.horario.ui.widgets.ChatPanelView.java

@Override
protected Parcelable onSaveInstanceState() {
    Bundle bundle = new Bundle();
    bundle.putParcelable(STATE_ORIGIN, super.onSaveInstanceState());
    bundle.putParcelable(STATE_OBJECT, mObject);
    bundle.putString(STATE_MODE, mMode.name());
    bundle.putString(STATE_MODE_TXT, mModeMessageText);
    return bundle;
}

From source file:com.artemchep.horario.ui.widgets.ContainersLayout.java

@Override
protected Parcelable onSaveInstanceState() {
    Bundle bundle = new Bundle();
    bundle.putParcelable(STATE_SUPER, super.onSaveInstanceState());
    bundle.putString(STATE_CONTAINERS_STATE, mState.name());
    return bundle;
}

From source file:fr.unix_experience.owncloud_sms.authenticators.OwnCloudAuthenticator.java

@Override
public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType,
        String[] requiredFeatures, Bundle options) throws NetworkErrorException {
    final Bundle result;
    final Intent intent;

    intent = new Intent(_context, LoginActivity.class);

    result = new Bundle();
    result.putParcelable(AccountManager.KEY_INTENT, intent);
    return result;
}

From source file:com.afstd.sqlitecommander.app.filemanager.FMFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    // Serialize the current dropdown position.
    Parcelable state = fListView.onSaveInstanceState();
    outState.putParcelable("list_position", state);
    outState.putString(CURR_DIR, path);/*from ww w.  j  a  va  2s .c om*/
    outState.putSerializable(BACKSTACK, backstack);
}

From source file:cochrane343.journal.MainActivity.java

@Override
public void onSaveInstanceState(final Bundle savedInstanceState) {
    savedInstanceState.putParcelable(BUNDLE_KEY_MONTHLY_PAGER_ADAPTER_STATE,
            monthlyExpensesPagerAdapter.saveState());

    super.onSaveInstanceState(savedInstanceState);
}

From source file:com.codebutler.farebot.activities.CardInfoActivity.java

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

    setContentView(R.layout.activity_card_info);
    final ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
    mTabsAdapter = new TabPagerAdapter(this, viewPager);

    final ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setTitle(R.string.loading);

    new AsyncTask<Void, Void, Void>() {
        private Exception mException;
        public boolean mSpeakBalanceEnabled;

        @Override/*from w w w  . java 2s .  c  o m*/
        protected Void doInBackground(Void... voids) {
            try {
                Uri uri = getIntent().getData();
                Cursor cursor = getContentResolver().query(uri, null, null, null, null);
                startManagingCursor(cursor);
                cursor.moveToFirst();

                String data = cursor.getString(cursor.getColumnIndex(CardsTableColumns.DATA));

                mCard = Card.fromXml(data);
                mTransitData = mCard.parseTransitData();

                SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(CardInfoActivity.this);
                mSpeakBalanceEnabled = prefs.getBoolean("pref_key_speak_balance", false);
            } catch (Exception ex) {
                mException = ex;
            }
            return null;
        }

        @Override
        protected void onPostExecute(Void aVoid) {
            findViewById(R.id.loading).setVisibility(View.GONE);
            findViewById(R.id.pager).setVisibility(View.VISIBLE);

            if (mException != null) {
                if (mCard == null) {
                    Utils.showErrorAndFinish(CardInfoActivity.this, mException);
                } else {
                    Log.e("CardInfoActivity", "Error parsing transit data", mException);
                    showAdvancedInfo(mException);
                    finish();
                }
                return;
            }

            if (mTransitData == null) {
                showAdvancedInfo(new UnsupportedCardException());
                finish();
                return;
            }

            String titleSerial = (mTransitData.getSerialNumber() != null) ? mTransitData.getSerialNumber()
                    : Utils.getHexString(mCard.getTagId(), "");
            actionBar.setTitle(mTransitData.getCardName() + " " + titleSerial);

            Bundle args = new Bundle();
            args.putParcelable(AdvancedCardInfoActivity.EXTRA_CARD, mCard);
            args.putParcelable(EXTRA_TRANSIT_DATA, mTransitData);

            mTabsAdapter.addTab(actionBar.newTab().setText(R.string.balance), CardBalanceFragment.class, args);

            if (mTransitData.getTrips() != null) {
                int textId = (mTransitData instanceof SuicaTransitData) ? R.string.history : R.string.trips;
                mTabsAdapter.addTab(actionBar.newTab().setText(textId), CardTripsFragment.class, args);
            }

            if (mTransitData.getRefills() != null) {
                mTabsAdapter.addTab(actionBar.newTab().setText(R.string.refills), CardRefillsFragment.class,
                        args);
            }

            if (mTransitData.getSubscriptions() != null) {
                mTabsAdapter.addTab(actionBar.newTab().setText(R.string.subscriptions),
                        CardSubscriptionsFragment.class, args);
            }

            if (mTransitData.getInfo() != null) {
                mTabsAdapter.addTab(actionBar.newTab().setText(R.string.info), CardInfoFragment.class, args);
            }

            if (mTabsAdapter.getCount() > 1) {
                actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
            }

            boolean speakBalanceRequested = getIntent().getBooleanExtra(SPEAK_BALANCE_EXTRA, false);
            if (mSpeakBalanceEnabled && speakBalanceRequested) {
                mTTS = new TextToSpeech(CardInfoActivity.this, mTTSInitListener);
            }

            if (savedInstanceState != null) {
                viewPager.setCurrentItem(savedInstanceState.getInt(KEY_SELECTED_TAB, 0));
            }
        }
    }.execute();
}

From source file:com.gmail.emerssso.srbase.EditSRActivity.java

protected void onSaveInstanceState(@NonNull Bundle outState) {
    super.onSaveInstanceState(outState);
    saveState();//ww w .jav a 2 s  . c  o  m
    outState.putParcelable(SRContentProvider.SR_CONTENT_ITEM_TYPE, savedUri);
}

From source file:com.android.managedprovisioning.ProfileOwnerProvisioningActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    outState.putInt(KEY_STATUS, mCancelStatus);
    outState.putParcelable(KEY_PENDING_INTENT, mPendingProvisioningResult);
}

From source file:br.com.brolam.cloudvision.ui.helpers.ActivityHelper.java

/**
 * Salvar o state view do RecyclerView principal da atividade.
 * @param outState informar um Bundle vlido.
 *//*from w  ww .  j  a  va2s  .  com*/
protected void saveRecyclerViewState(Bundle outState) {
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
    if (recyclerView != null) {
        outState.putParcelable(RECYCLER_VIEW_STATE, recyclerView.getLayoutManager().onSaveInstanceState());
    }
}