List of usage examples for android.os Bundle putParcelable
public void putParcelable(@Nullable String key, @Nullable Parcelable value)
From source file:com.android.tv.settings.dialog.SettingsLayoutFragment.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.putInt(EXTRA_ACTION_SELECTED_INDEX, (mListView != null) ? mListView.getSelectedPosition() : -1); outState.putString(EXTRA_ACTION_NAME, mName); outState.putBoolean(EXTRA_ENTRY_TRANSITION_PERFORMED, mEntryTransitionPerformed); }
From source file:com.gmail.boiledorange73.ut.map.MapActivityBase.java
/** Called when the current status is saved. */ @Override/*from www .ja v a 2 s. com*/ protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (outState != null) { MapState mapState = this.getCurrentMapState(); if (mapState != null) { outState.putParcelable("MapState", mapState); } } }
From source file:cc.mintcoin.wallet.ui.SendCoinsFragment.java
private void saveInstanceState(final Bundle outState) { outState.putParcelable("payment_intent", paymentIntent); outState.putSerializable("state", state); if (validatedAddress != null) outState.putParcelable("validated_address", validatedAddress); if (sentTransaction != null) outState.putSerializable("sent_transaction_hash", sentTransaction.getHash()); if (directPaymentAck != null) outState.putBoolean("direct_payment_ack", directPaymentAck); }
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.markupartist.sthlmtraveling.PlannerFragment.java
@Override public void onSaveInstanceState(Bundle outState) { outState.putInt("level", mStackLevel); if (mStartPoint != null) outState.putParcelable("startPoint", mStartPoint); if (mEndPoint != null) outState.putParcelable("endPoint", mEndPoint); if (mViaPoint != null) outState.putParcelable("viaPoint", mViaPoint); super.onSaveInstanceState(outState); }
From source file:com.bangz.smartmute.LocationsMapFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (mSavedMarkerExInfos.isEmpty() == false) { mSavedMarkerExInfos.clear();//from w ww . j av a2 s .c o m } Collection<Marker> newplaces = markerManager.getCollection(MC_ID_NEWPLACE).getMarkers(); for (Marker marker : newplaces) { mSavedMarkerExInfos.add(markerManager.getExtraInfo(marker)); } Collection<Marker> currplace = markerManager.getCollection(MC_ID_CURRPLACE).getMarkers(); for (Marker marker : currplace) { mSavedMarkerExInfos.add(markerManager.getExtraInfo(marker)); } Bundle mybundle = new Bundle(); mybundle.putParcelableArrayList(KEY_STATE_MARKERS, mSavedMarkerExInfos); mybundle.putInt(KEY_STATE_MAPINIT, mapInitState); mybundle.putBoolean(KEY_STATE_LOCATION_UPDATED, bLocationUpdated); mybundle.putInt(KEY_STATE_LOCATION_UPDATE_TYPE, mLocationUpdateType); if (markerSelected != null) { MarkerExInfo meiselected = markerManager.getExtraInfo(markerSelected); mybundle.putParcelable(KEY_STATE_SELECT_MARKER, meiselected); } outState.putBundle(KEY_STATE_MYARGUMENT, mybundle); }
From source file:fr.univsavoie.ltp.client.MainActivity.java
protected void onSaveInstanceState(Bundle outState) { outState.putParcelable("start", startPoint); outState.putParcelable("destination", destinationPoint); outState.putParcelableArrayList("viapoints", viaPoints); outState.putParcelable("road", mRoad); outState.putInt("zoom_level", map.getZoomLevel()); GeoPoint c = (GeoPoint) map.getMapCenter(); outState.putParcelable("map_center", c); outState.putParcelableArrayList("poi", mPOIs); }
From source file:com.chen.mail.ui.FolderListFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (mListView != null) { outState.putParcelable(BUNDLE_LIST_STATE, mListView.onSaveInstanceState()); }/*from w w w. j a v a2 s. c o m*/ if (mSelectedFolderUri != null) { outState.putString(BUNDLE_SELECTED_FOLDER, mSelectedFolderUri.toString()); } outState.putInt(BUNDLE_SELECTED_TYPE, mSelectedFolderType); }
From source file:androidx.media.MediaSession2StubImplBase.java
private void connect(Bundle extras, final ResultReceiver cb) { final ControllerInfo controllerInfo = createControllerInfo(extras); mSession.getCallbackExecutor().execute(new Runnable() { @Override/*from w w w .j a va 2s . co m*/ public void run() { if (mSession.isClosed()) { return; } synchronized (mLock) { // Keep connecting controllers. // This helps sessions to call APIs in the onConnect() // (e.g. setCustomLayout()) instead of pending them. mConnectingControllers.add(controllerInfo.getId()); } SessionCommandGroup2 allowedCommands = mSession.getCallback().onConnect(mSession.getInstance(), controllerInfo); // Don't reject connection for the request from trusted app. // Otherwise server will fail to retrieve session's information to dispatch // media keys to. boolean accept = allowedCommands != null || controllerInfo.isTrusted(); if (accept) { if (DEBUG) { Log.d(TAG, "Accepting connection, controllerInfo=" + controllerInfo + " allowedCommands=" + allowedCommands); } if (allowedCommands == null) { // For trusted apps, send non-null allowed commands to keep // connection. allowedCommands = new SessionCommandGroup2(); } synchronized (mLock) { mConnectingControllers.remove(controllerInfo.getId()); mControllers.put(controllerInfo.getId(), controllerInfo); mAllowedCommandGroupMap.put(controllerInfo, allowedCommands); } // If connection is accepted, notify the current state to the // controller. It's needed because we cannot call synchronous calls // between session/controller. // Note: We're doing this after the onConnectionChanged(), but there's // no guarantee that events here are notified after the // onConnected() because IMediaController2 is oneway (i.e. async // call) and Stub will use thread poll for incoming calls. final Bundle resultData = new Bundle(); resultData.putBundle(ARGUMENT_ALLOWED_COMMANDS, allowedCommands.toBundle()); resultData.putInt(ARGUMENT_PLAYER_STATE, mSession.getPlayerState()); resultData.putInt(ARGUMENT_BUFFERING_STATE, mSession.getBufferingState()); resultData.putParcelable(ARGUMENT_PLAYBACK_STATE_COMPAT, mSession.getPlaybackStateCompat()); resultData.putInt(ARGUMENT_REPEAT_MODE, mSession.getRepeatMode()); resultData.putInt(ARGUMENT_SHUFFLE_MODE, mSession.getShuffleMode()); final List<MediaItem2> playlist = allowedCommands.hasCommand(COMMAND_CODE_PLAYLIST_GET_LIST) ? mSession.getPlaylist() : null; if (playlist != null) { resultData.putParcelableArray(ARGUMENT_PLAYLIST, MediaUtils2.toMediaItem2ParcelableArray(playlist)); } final MediaItem2 currentMediaItem = allowedCommands.hasCommand( COMMAND_CODE_PLAYLIST_GET_CURRENT_MEDIA_ITEM) ? mSession.getCurrentMediaItem() : null; if (currentMediaItem != null) { resultData.putBundle(ARGUMENT_MEDIA_ITEM, currentMediaItem.toBundle()); } resultData.putBundle(ARGUMENT_PLAYBACK_INFO, mSession.getPlaybackInfo().toBundle()); final MediaMetadata2 playlistMetadata = mSession.getPlaylistMetadata(); if (playlistMetadata != null) { resultData.putBundle(ARGUMENT_PLAYLIST_METADATA, playlistMetadata.toBundle()); } // Double check if session is still there, because close() can be // called in another thread. if (mSession.isClosed()) { return; } cb.send(CONNECT_RESULT_CONNECTED, resultData); } else { synchronized (mLock) { mConnectingControllers.remove(controllerInfo.getId()); } if (DEBUG) { Log.d(TAG, "Rejecting connection, controllerInfo=" + controllerInfo); } cb.send(CONNECT_RESULT_DISCONNECTED, null); } } }); }
From source file:cn.edu.wyu.documentviewer.DocumentsActivity.java
@Override protected void onSaveInstanceState(Bundle state) { super.onSaveInstanceState(state); state.putParcelable(EXTRA_STATE, mState); }