public I arg(String key, SparseArray<? extends Parcelable> value) { args.putSparseParcelableArray(key, value); return (I) this; }
/** * Inserts a SparceArray of Parcelable values into the mapping of this * Bundle, replacing any existing value for the given key. Either key * or value may be null. * * @param key a String, or null * @param value a SparseArray of Parcelable objects, or null */ public Bundler putSparseParcelableArray(String key, SparseArray<? extends Parcelable> value) { bundle.putSparseParcelableArray(key, value); return this; }
/** * Inserts a SparceArray of Parcelable values into the mapping of this * Bundle, replacing any existing value for the given key. Either key * or value may be null. * * @param key a String, or null * @param value a SparseArray of Parcelable objects, or null */ public Bundler putSparseParcelableArray(String key, SparseArray<? extends Parcelable> value) { bundle.putSparseParcelableArray(key, value); return this; }
public BundleBuilder putSparseParcelableArray(String key, SparseArray<? extends Parcelable> value) { bundle.putSparseParcelableArray(key, value); return this; }
/** * Inserts a SparceArray of Parcelable values into the mapping of this Bundle, replacing any * existing value for the given key. Either key or value may be null. * * @param key a String, or null * @param value a SparseArray of Parcelable objects, or null * @return this bundler instance to chain method calls */ public Bundler putSparseParcelableArray(String key, SparseArray<? extends Parcelable> value) { delegate.putSparseParcelableArray(key, value); return this; }
@Override public Parcelable saveState() { Bundle bundle = new Bundle(); bundle.putSparseParcelableArray(KEY_SAVED_PAGES, savedPages); bundle.putInt(KEY_MAX_PAGES_TO_STATE_SAVE, maxPagesToStateSave); bundle.putIntegerArrayList(KEY_SAVE_PAGE_HISTORY, savedPageHistory); return bundle; }
@Override public Parcelable saveState() { Bundle bundle = new Bundle(); bundle.putBoolean(KEY_SAVES_STATE, savesState); bundle.putSparseParcelableArray(KEY_SAVED_PAGES, savedPages); int[] visiblePageIdsKeys = new int[visiblePageIds.size()]; String[] visiblePageIdsValues = new String[visiblePageIds.size()]; for (int i = 0; i < visiblePageIds.size(); i++) { visiblePageIdsKeys[i] = visiblePageIds.keyAt(i); visiblePageIdsValues[i] = visiblePageIds.valueAt(i); } bundle.putIntArray(KEY_VISIBLE_PAGE_IDS_KEYS, visiblePageIdsKeys); bundle.putStringArray(KEY_VISIBLE_PAGE_IDS_VALUES, visiblePageIdsValues); return bundle; }
@Override public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); if (drawerView != null) { drawerViewState = new SparseArray<>(); drawerView.saveHierarchyState(drawerViewState); outState.putSparseParcelableArray(KEY_DRAWER_VIEW_STATE, drawerViewState); } } }
private void saveViewState(@NonNull View view) { hasSavedViewState = true; viewState = new Bundle(getClass().getClassLoader()); SparseArray<Parcelable> hierarchyState = new SparseArray<>(); view.saveHierarchyState(hierarchyState); viewState.putSparseParcelableArray(KEY_VIEW_STATE_HIERARCHY, hierarchyState); Bundle stateBundle = new Bundle(getClass().getClassLoader()); onSaveViewState(view, stateBundle); viewState.putBundle(KEY_VIEW_STATE_BUNDLE, stateBundle); List<LifecycleListener> listeners = new ArrayList<>(lifecycleListeners); for (LifecycleListener lifecycleListener : listeners) { lifecycleListener.onSaveViewState(this, viewState); } }
public void saveActionViewStates(Bundle outStates) { SparseArray<Parcelable> viewStates = null; final int itemCount = size(); for (int i = 0; i < itemCount; i++) { final android.view.MenuItem item = getItem(i); final View v = MenuItemCompat.getActionView(item); if (v != null && v.getId() != View.NO_ID) { if (viewStates == null) { viewStates = new SparseArray<Parcelable>(); } v.saveHierarchyState(viewStates); if (MenuItemCompat.isActionViewExpanded(item)) { outStates.putInt(EXPANDED_ACTION_VIEW_ID, item.getItemId()); } } } if (viewStates != null) { outStates.putSparseParcelableArray(getActionViewStatesKey(), viewStates); } }
when(bundle.getParcelableArrayList(anyString())).thenAnswer(get); doAnswer(put).when(bundle).putSparseParcelableArray(anyString(), any(SparseArray.class)); when(bundle.getSparseParcelableArray(anyString())).thenAnswer(get);
@Override public final void saveInstanceState(@NonNull final Bundle outState) { outState.putSparseParcelableArray(SAVED_INSTANCE_STATES_EXTRA, savedInstanceStates); }
/** * The method, which is invoked by a {@link TabSwitcher} to save the current state of a tab. It * initializes the view holder pattern, which is provided by the decorator and then delegates * the method call to the decorator's custom implementation of the method * <code>onSaveInstanceState(...):void</code>. * * @param view * The view, which is used to visualize the tab, as an instance of the class {@link * View} * @param tab * The tab, whose state should be saved, as an instance of the class {@link Tab}. The * tab may not be null * @param index * The index of the tab, whose state should be saved, as an {@link Integer} value * @return The bundle, which has been used to save the state, as an instance of the class {@link * Bundle}. The bundle may not be null */ @NonNull public final Bundle saveInstanceState(@NonNull final View view, @NonNull final Tab tab, final int index) { setCurrentParentView(view); int viewType = getViewType(tab, index); Bundle outState = new Bundle(); SparseArray<Parcelable> viewStates = new SparseArray<>(); view.saveHierarchyState(viewStates); outState.putSparseParcelableArray(VIEW_HIERARCHY_STATE_EXTRA, viewStates); onSaveInstanceState(view, tab, index, viewType, outState); return outState; }
/** * Inserts a SparceArray of Parcelable values into the mapping of this * Bundle, replacing any existing value for the given key. Either key * or value may be null. * * @param key a String, or null * @param value a SparseArray of Parcelable objects, or null */ public Bundler putSparseParcelableArray(String key, SparseArray<? extends Parcelable> value) { bundle.putSparseParcelableArray(key, value); return this; }
/** * Inserts a SparceArray of Parcelable values into the mapping of this * Bundle, replacing any existing value for the given key. Either key * or value may be null. * * @param key a String, or null * @param value a SparseArray of Parcelable objects, or null * @return this bundler instance to chain method calls */ public Bundler putSparseParcelableArray(String key, SparseArray<? extends Parcelable> value) { delegate.putSparseParcelableArray(key, value); return this; }
final void save(Bundle outState) { saveViewState(); if (viewState != null) { outState.putSparseParcelableArray(VIEW_STATE + hashCode(), viewState); } viewState = null; }
@Override public void writeToParcel(final Parcel parcel, final int arg1) { final Bundle b = new Bundle(); b.putString("local_name_complete", mLocalNameComplete); b.putString("local_name_short", mLocalNameShort); b.putSparseParcelableArray("records_array", mAdRecords); parcel.writeBundle(b); }
@Override protected void onSaveInstanceState(Bundle outState) { // Be sure to call the super class. super.onSaveInstanceState(outState); outState.putSparseParcelableArray(PRESENTATION_KEY, mSavedPresentationContents); }
@Override protected void onSaveInstanceState(Bundle outState) { // Be sure to call the super class. super.onSaveInstanceState(outState); outState.putSparseParcelableArray(PRESENTATION_KEY, mSavedPresentationContents); }
public static ProfileChooserFragment newInstance(SparseArray<Profile> profileSparseArray, ArrayList<Item> items, int accent, boolean showAdd, String titleValue, int icon) { Bundle bundle = new Bundle(); bundle.putSparseParcelableArray("profileSparseArray", profileSparseArray); bundle.putParcelableArrayList("items", items); bundle.putInt("accent", accent); bundle.putBoolean("showAdd", showAdd); bundle.putString("titleValue", titleValue); bundle.putInt("icon", icon); ProfileChooserFragment fragment = new ProfileChooserFragment(); fragment.setArguments(bundle); return fragment; }