List of usage examples for android.os Bundle putParcelable
public void putParcelable(@Nullable String key, @Nullable Parcelable value)
From source file:com.andrewshu.android.reddit.mail.InboxListActivity.java
@Override protected void onSaveInstanceState(Bundle state) { super.onSaveInstanceState(state); state.putString(Constants.REPLY_TARGET_NAME_KEY, mReplyTargetName); state.putString(Constants.AFTER_KEY, mAfter); state.putString(Constants.BEFORE_KEY, mBefore); state.putInt(Constants.THREAD_COUNT_KEY, mCount); state.putString(Constants.LAST_AFTER_KEY, mLastAfter); state.putString(Constants.LAST_BEFORE_KEY, mLastBefore); state.putInt(Constants.THREAD_LAST_COUNT_KEY, mLastCount); state.putParcelable(Constants.VOTE_TARGET_THING_INFO_KEY, mVoteTargetThingInfo); state.putString(Constants.WHICH_INBOX_KEY, mWhichInbox); }
From source file:com.android.tv.settings.dialog.DialogFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString(EXTRA_CONTENT_TITLE, mTitle); outState.putString(EXTRA_CONTENT_BREADCRUMB, mBreadcrumb); outState.putString(EXTRA_CONTENT_DESCRIPTION, mDescription); outState.putInt(EXTRA_CONTENT_ICON_RESOURCE_ID, mIconResourceId); outState.putParcelable(EXTRA_CONTENT_ICON_URI, mIconUri); outState.putParcelable(EXTRA_CONTENT_ICON_BITMAP, mIconBitmap); outState.putInt(EXTRA_CONTENT_ICON_BACKGROUND, mIconBackgroundColor); outState.putParcelableArrayList(EXTRA_ACTION_ACTIONS, mActions); outState.putInt(EXTRA_ACTION_SELECTED_INDEX, (mListView != null) ? getSelectedItemPosition() : mSelectedIndex); outState.putString(EXTRA_ACTION_NAME, mName); outState.putBoolean(EXTRA_ENTRY_TRANSITION_PERFORMED, mEntryTransitionPerformed); }
From source file:com.borax12.materialdaterangepicker.single.time.TimePickerDialog.java
@Override public void onSaveInstanceState(@NonNull Bundle outState) { if (mTimePicker != null) { outState.putParcelable(KEY_INITIAL_TIME, mTimePicker.getTime()); outState.putBoolean(KEY_IS_24_HOUR_VIEW, mIs24HourMode); outState.putInt(KEY_CURRENT_ITEM_SHOWING, mTimePicker.getCurrentItemShowing()); outState.putBoolean(KEY_IN_KB_MODE, mInKbMode); if (mInKbMode) { outState.putIntegerArrayList(KEY_TYPED_TIMES, mTypedTimes); }//from w w w .j a va2s . c o m outState.putString(KEY_TITLE, mTitle); outState.putBoolean(KEY_THEME_DARK, mThemeDark); outState.putBoolean(KEY_THEME_DARK_CHANGED, mThemeDarkChanged); outState.putInt(KEY_ACCENT, mAccentColor); outState.putBoolean(KEY_VIBRATE, mVibrate); outState.putBoolean(KEY_DISMISS, mDismissOnPause); outState.putParcelableArray(KEY_SELECTABLE_TIMES, mSelectableTimes); outState.putParcelable(KEY_MIN_TIME, mMinTime); outState.putParcelable(KEY_MAX_TIME, mMaxTime); outState.putBoolean(KEY_ENABLE_SECONDS, mEnableSeconds); outState.putInt(KEY_OK_RESID, mOkResid); outState.putString(KEY_OK_STRING, mOkString); outState.putInt(KEY_CANCEL_RESID, mCancelResid); outState.putString(KEY_CANCEL_STRING, mCancelString); } }
From source file:androidx.media.MediaBrowserServiceCompat.java
void performLoadItem(String itemId, ConnectionRecord connection, final ResultReceiver receiver) { final Result<MediaBrowserCompat.MediaItem> result = new Result<MediaBrowserCompat.MediaItem>(itemId) { @Override/*w w w .j a v a2s. c om*/ void onResultSent(MediaBrowserCompat.MediaItem item) { if ((getFlags() & RESULT_FLAG_ON_LOAD_ITEM_NOT_IMPLEMENTED) != 0) { receiver.send(RESULT_ERROR, null); return; } Bundle bundle = new Bundle(); bundle.putParcelable(KEY_MEDIA_ITEM, item); receiver.send(RESULT_OK, bundle); } }; mCurConnection = connection; onLoadItem(itemId, result); mCurConnection = null; if (!result.isDone()) { throw new IllegalStateException( "onLoadItem must call detach() or sendResult()" + " before returning for id=" + itemId); } }
From source file:de.sourcestream.movieDB.controller.TVList.java
/** * Called to ask the fragment to save its current dynamic state, * so it can later be reconstructed in a new instance of its process is restarted. * * @param outState Bundle in which to place your saved state. *//*from w w w. ja v a 2s . co m*/ @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); // Used to avoid bug where we add item in the back stack // and if we change orientation twice the item from the back stack has null values if (save != null) outState.putBundle("save", save); else { Bundle send = new Bundle(); send.putInt("checkLoadMore", checkLoadMore); send.putInt("totalPages", totalPages); send.putString("currentListURL", getCurrentList()); send.putString("title", getTitle()); send.putBoolean("isLoading", isLoading); send.putInt("lastVisitedTV", lastVisitedTV); if (backState == 1) { send.putInt("backState", 1); send.putParcelableArrayList("listData", tvList); // used to restore the scroll listener variables send.putInt("currentPage", endlessScrollListener.getCurrentPage()); send.putInt("oldCount", endlessScrollListener.getOldCount()); send.putBoolean("loading", endlessScrollListener.getLoading()); // Save scroll position if (listView != null) { Parcelable listState = listView.onSaveInstanceState(); send.putParcelable("listViewScroll", listState); } } else send.putInt("backState", 0); outState.putBundle("save", send); } }
From source file:com.android.messaging.ui.conversation.ConversationFragment.java
@Override public void onSaveInstanceState(final Bundle outState) { super.onSaveInstanceState(outState); if (mListState != null) { outState.putParcelable(SAVED_INSTANCE_STATE_LIST_VIEW_STATE_KEY, mListState); }//from ww w . j a va 2 s .c o m mComposeMessageView.saveInputState(outState); }
From source file:de.sourcestream.movieDB.controller.MovieList.java
/** * Called to ask the fragment to save its current dynamic state, * so it can later be reconstructed in a new instance of its process is restarted. * * @param outState Bundle in which to place your saved state. *//*ww w . j a va2s .c o m*/ @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); // Used to avoid bug where we add item in the back stack // and if we change orientation twice the item from the back stack has null values if (save != null) outState.putBundle("save", save); else { Bundle send = new Bundle(); send.putInt("checkLoadMore", checkLoadMore); send.putInt("totalPages", totalPages); send.putString("currentListURL", getCurrentList()); send.putString("title", getTitle()); send.putBoolean("isLoading", isLoading); send.putInt("lastVisitedMovie", lastVisitedMovie); if (backState == 1) { send.putInt("backState", 1); send.putParcelableArrayList("listData", moviesList); // used to restore the scroll listener variables send.putInt("currentPage", endlessScrollListener.getCurrentPage()); send.putInt("oldCount", endlessScrollListener.getOldCount()); send.putBoolean("loading", endlessScrollListener.getLoading()); // Save scroll position if (listView != null) { Parcelable listState = listView.onSaveInstanceState(); send.putParcelable("listViewScroll", listState); } } else send.putInt("backState", 0); outState.putBundle("save", send); } }
From source file:edu.cens.loci.ui.VisitDetailActivity.java
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // Handle passing action off to correct handler. if (view.getTag() instanceof ViewEntry) { ViewEntry entry = (ViewEntry) view.getTag(); switch (entry.action) { case LIST_ACTION_VIEW_WIFIS: Bundle args = new Bundle(); args.putString("wifi", entry.extra_string); //Log.d(TAG, "save:" + entry.extra_string); showDialog(DIALOG_WIFI, args); break; case LIST_ACTION_VIEW_PLACE: if (entry.intent != null) { startActivity(entry.intent); }/* w w w. j ava 2s .c o m*/ break; case LIST_ACTION_VIEW_RECOGNITION: args = new Bundle(); args.putString("recognition", entry.extra_string); showDialog(DIALOG_RECOGNITION, args); case LIST_ACTION_NO_ACTION: break; case LIST_ACTION_ADD_PLACE: if (entry.intent != null) { startActivityForResult(entry.intent, SUBACTIVITY_ADD_PLACE); } break; case LIST_ACTION_CHANGE_PLACE: if (entry.intent != null) { args = new Bundle(); args.putParcelable("intent", entry.intent); showDialog(DIALOG_CHANGE_PLACE, args); } break; } } }