本文整理了Java中android.os.Bundle.putSparseParcelableArray()
方法的一些代码示例,展示了Bundle.putSparseParcelableArray()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bundle.putSparseParcelableArray()
方法的具体详情如下:
包路径:android.os.Bundle
类名称:Bundle
方法名:putSparseParcelableArray
暂无
代码示例来源:origin: androidannotations/androidannotations
public I arg(String key, SparseArray<? extends Parcelable> value) {
args.putSparseParcelableArray(key, value);
return (I) this;
}
代码示例来源:origin: ogaclejapan/SmartTabLayout
/**
* 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;
}
代码示例来源:origin: ogaclejapan/SmartTabLayout
/**
* 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;
}
代码示例来源:origin: bluelinelabs/Conductor
public BundleBuilder putSparseParcelableArray(String key, SparseArray<? extends Parcelable> value) {
bundle.putSparseParcelableArray(key, value);
return this;
}
代码示例来源:origin: f2prateek/dart
/**
* 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;
}
代码示例来源:origin: bluelinelabs/Conductor
@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;
}
代码示例来源:origin: bluelinelabs/Conductor
@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;
}
代码示例来源:origin: seven332/EhViewer
@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);
}
}
}
代码示例来源:origin: bluelinelabs/Conductor
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);
}
}
代码示例来源:origin: ZieIony/Carbon
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);
}
}
代码示例来源:origin: konmik/nucleus
when(bundle.getParcelableArrayList(anyString())).thenAnswer(get);
doAnswer(put).when(bundle).putSparseParcelableArray(anyString(), any(SparseArray.class));
when(bundle.getSparseParcelableArray(anyString())).thenAnswer(get);
代码示例来源:origin: michael-rapp/ChromeLikeTabSwitcher
@Override
public final void saveInstanceState(@NonNull final Bundle outState) {
outState.putSparseParcelableArray(SAVED_INSTANCE_STATES_EXTRA, savedInstanceStates);
}
代码示例来源:origin: michael-rapp/ChromeLikeTabSwitcher
/**
* 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;
}
代码示例来源:origin: 80945540/FreeBook
/**
* 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;
}
代码示例来源:origin: com.github.stephanenicolas.dart.v2/henson
/**
* 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;
}
代码示例来源:origin: wealthfront/magellan
final void save(Bundle outState) {
saveViewState();
if (viewState != null) {
outState.putSparseParcelableArray(VIEW_STATE + hashCode(), viewState);
}
viewState = null;
}
代码示例来源:origin: alt236/Bluetooth-LE-Library---Android
@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);
}
代码示例来源:origin: qiubiteme/android_api_demos
@Override
protected void onSaveInstanceState(Bundle outState) {
// Be sure to call the super class.
super.onSaveInstanceState(outState);
outState.putSparseParcelableArray(PRESENTATION_KEY, mSavedPresentationContents);
}
代码示例来源:origin: li2/learning-android-open-source
@Override
protected void onSaveInstanceState(Bundle outState) {
// Be sure to call the super class.
super.onSaveInstanceState(outState);
outState.putSparseParcelableArray(PRESENTATION_KEY, mSavedPresentationContents);
}
代码示例来源:origin: raphaelbussa/HeaderView
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;
}
内容来源于网络,如有侵权,请联系作者删除!