Example usage for android.os Bundle putSerializable

List of usage examples for android.os Bundle putSerializable

Introduction

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

Prototype

@Override
public void putSerializable(@Nullable String key, @Nullable Serializable value) 

Source Link

Document

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

Usage

From source file:net.reichholf.dreamdroid.activities.TimerEditActivity.java

@Override
public void onSaveInstanceState(Bundle outState) {
    final ExtendedHashMap timer = mTimer;
    final ExtendedHashMap timerOld = mTimerOld;

    outState.putSerializable("timer", timer);
    outState.putSerializable("timerOld", timerOld);

    if (mProgress != null) {
        if (mProgress.isShowing()) {
            mProgress.dismiss();//from   ww  w .j  a v  a2s  .c o  m
        }
    }

    super.onSaveInstanceState(outState);
}

From source file:com.mindmeapp.extensions.ExtensionData.java

/**
 * Serializes the contents of this object to a {@link Bundle}.
 *//*from   w  w w  . j a v a  2s .  co m*/
public Bundle toBundle() {
    Bundle data = new Bundle();
    data.putBoolean(KEY_VISIBLE, mVisible);
    data.putInt(KEY_ICON, mIcon);
    data.putString(KEY_ICON_URI, (mIconUri == null ? null : mIconUri.toString()));
    data.putString(KEY_STATUS_TO_DISPLAY, mStatusToDisplay);
    data.putString(KEY_STATUS_TO_SPEAK, mStatusToSpeak);
    data.putParcelable(KEY_VIEWS_TO_DISPLAY, mViewsToDisplay);
    data.putString(KEY_CONTENT_DESCRIPTION, mContentDescription);
    data.putSerializable(KEY_LANGUAGE_TO_SPEAK, mLanguageToSpeak);
    data.putInt(KEY_BACKGROUND, mBackground);
    data.putString(KEY_BACKGROUND_URI, (mBackgroundUri == null ? null : mBackgroundUri.toString()));
    return data;
}

From source file:ch.blinkenlights.android.vanilla.LibraryPagerAdapter.java

@Override
public Parcelable saveState() {
    Bundle out = new Bundle(10);
    if (mArtistAdapter != null)
        out.putSerializable("limiter_artists", mArtistAdapter.getLimiter());
    if (mAlbArtAdapter != null)
        out.putSerializable("limiter_albumartists", mAlbArtAdapter.getLimiter());
    if (mComposerAdapter != null)
        out.putSerializable("limiter_composer", mComposerAdapter.getLimiter());
    if (mAlbumAdapter != null)
        out.putSerializable("limiter_albums", mAlbumAdapter.getLimiter());
    if (mSongAdapter != null)
        out.putSerializable("limiter_songs", mSongAdapter.getLimiter());
    if (mFilesAdapter != null)
        out.putSerializable("limiter_files", mFilesAdapter.getLimiter());

    maintainPosition();/*from   w  w  w  .j  a va2  s.  co m*/
    return out;
}

From source file:com.android.calendar.event.EditEventFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    mView.prepareForSave();/*from www  .j  a  v  a2  s  .  c o m*/
    outState.putSerializable(BUNDLE_KEY_MODEL, mModel);
    outState.putInt(BUNDLE_KEY_EDIT_STATE, mModification);
    if (mEventBundle == null && mEvent != null) {
        mEventBundle = new EventBundle();
        mEventBundle.id = mEvent.id;
        if (mEvent.startTime != null) {
            mEventBundle.start = mEvent.startTime.toMillis(true);
        }
        if (mEvent.endTime != null) {
            mEventBundle.end = mEvent.startTime.toMillis(true);
        }
    }
    outState.putBoolean(BUNDLE_KEY_EDIT_ON_LAUNCH, mShowModifyDialogOnLaunch);
    outState.putSerializable(BUNDLE_KEY_EVENT, mEventBundle);
    outState.putBoolean(BUNDLE_KEY_READ_ONLY, mIsReadOnly);
    outState.putBoolean(BUNDLE_KEY_SHOW_COLOR_PALETTE, mView.isColorPaletteVisible());

    outState.putBoolean("EditEventView_timebuttonclicked", mView.mTimeSelectedWasStartTime);
    outState.putBoolean(BUNDLE_KEY_DATE_BUTTON_CLICKED, mView.mDateSelectedWasStartDate);
}

From source file:com.jacr.instagramtrendreader.Main.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    setContentView(R.layout.activity_main);

    /* Customizing ActionBar */
    Resources r = getResources();
    ActionBar ab = super.getActionBar(false);
    ab.setIcon(r.getDrawable(R.drawable.ic_menu_home));
    ab.setTitle(Util.getTitleActivity(getString(R.string.title_my_gallery_app)));

    /* Views *//*from  w w  w .  j av  a  2s  .c om*/
    layoutThumbnail = (TableLayout) findViewById(R.id.layoutThumbnail);
    layoutThumbnail.setPadding(1, 1, 1, 1);

    /* Setting Viewpager and Indicator */
    mPager = (ViewPager) findViewById(R.id.pagerMain);
    mAdapter = new ViewPagerAdapter<MainFragment>(getSupportFragmentManager());
    mPager.setOnPageChangeListener(new OnPageChangeListener() {

        @Override
        public void onPageScrollStateChanged(int arg0) {
        }

        @Override
        public void onPageScrolled(int arg0, float arg1, int arg2) {
        }

        @Override
        public void onPageSelected(int arg0) {
            int key = feedReader.getListThumbnailKeys().get(arg0);
            feedReader.highlightThumbnail(key);

        }

    });

    /* Receiver */
    mReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            Bundle extras = intent.getExtras();
            if (action.contentEquals(ACTION_IMAGE_CLICK)) {
                int key = extras.getInt(ACTION_IMAGE_CLICK);
                if (key != -1) {
                    Intent in = new Intent(Main.this, ImageDetails.class);
                    Bundle b = new Bundle();

                    /*
                     * Warning with Error FAILED BINDED TRANSACTION: it
                     * happens When the transfer of "extras" out of memory.
                     * in This case, when images are sent in intent.
                     */
                    b.putSerializable(ImageDetails.KEY_THUMBNAIL_DATA, feedReader.getListThumbnailData());
                    b.putSerializable(ImageDetails.KEY_THUMBNAIL_KEYS, feedReader.getListThumbnailKeys());
                    b.putInt(ImageDetails.KEY_THUMBNAIL_ACTUAL_KEY, key);
                    in.putExtras(b);
                    startActivity(in);
                }

            }
        }
    };
    IntentFilter filter = new IntentFilter();
    filter.addAction(ACTION_IMAGE_CLICK);
    registerReceiver(mReceiver, filter);

    /* Load data from Instagram */
    cargarFeedReader();
}

From source file:org.elasticdroid.SshConnectorView.java

/**
 * Save state of the activity on destroy/stop.
 * Saves://from  www  . j a  va  2  s.c  o m
 * <ul>
 * <li></li>
 * </ul>
 */
@Override
public void onSaveInstanceState(Bundle saveState) {
    // if a dialog is displayed when this happens, dismiss it
    if (alertDialogDisplayed) {
        alertDialogBox.dismiss();
    }
    //save the info as to whether dialog is displayed
    saveState.putBoolean("alertDialogDisplayed", alertDialogDisplayed);
    //save the dialog msg
    saveState.putString("alertDialogMessage", alertDialogMessage);

    //save the list of open ports 
    if (openPorts != null) {
        saveState.putSerializable("openPorts", openPorts);
        saveState.putInt("selectedPortPos",
                ((Spinner) findViewById(R.id.sshConnectorPortSpinner)).getSelectedItemPosition());
    }
    //save if progress dialog is being displayed.
    saveState.putBoolean("progressDialogDisplayed", progressDialogDisplayed);

    //save the username entered if it is not the default user name
    String curUsername = ((EditText) findViewById(R.id.sshConnectorUsernameEditTextView)).getText().toString();
    if (!curUsername.equals(this.getString(R.string.ssh_defaultuser))) {
        saveState.putString("sshUsername", curUsername);
    }

    //save the state of the checkbox that specifies whether pubkey auth should be used or not
    saveState.putBoolean("usePubkeyAuth",
            ((CheckBox) findViewById(R.id.sshConnectorUsePublicKeyAuth)).isChecked());
}

From source file:com.audiokernel.euphonyrmt.MainMenuActivity.java

@Override
public void onSaveInstanceState(final Bundle outState) {
    outState.putSerializable(EXTRA_DISPLAY_MODE, mCurrentDisplayMode);
    outState.putSerializable(EXTRA_SLIDING_PANEL_EXPANDED, mSlidingLayout.isPanelExpanded());
    super.onSaveInstanceState(outState);
}

From source file:net.reichholf.dreamdroid.fragment.ServiceListFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    outState.putString(BUNDLE_KEY_NAVNAME, mNavName);
    outState.putString(BUNDLE_KEY_NAVREFERENCE, mNavReference);
    outState.putString(BUNDLE_KEY_DETAILNAME, mDetailName);
    outState.putString(BUNDLE_KEY_DETAILREFERENCE, mDetailReference);
    outState.putSerializable(BUNDLE_KEY_HISTORY, mHistory);
    outState.putSerializable(BUNDLE_KEY_NAVITEMS, mNavItems);
    outState.putSerializable(BUNDLE_KEY_DETAILITEMS, mDetailItems);
    outState.putParcelable(BUNDLE_KEY_CURRENT_SERVICE, mCurrentService);

    super.onSaveInstanceState(outState);
}

From source file:com.eugene.fithealthmaingit.UI.NavFragments.FragmentJournalMainHome.java

@Override
public void onSaveInstanceState(Bundle outState) {
    outState.putSerializable(Globals.JOURNAL_DATE, mDate);
}

From source file:com.nearnotes.NoteEdit.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (this.getView() == null) {
        return;//from   w w  w . j  a  va2s.c o m
    } else {
        // saveState();
        outState.putSerializable(NotesDbAdapter.KEY_ROWID, mRowId);
    }
}