The second Android 11 Developer Preview is now available, test it out and share your feedback.

StatefulAdapter

interface StatefulAdapter
androidx.viewpager2.adapter.StatefulAdapter

ViewPager2 adapters should implement this interface to be called during View#onSaveInstanceState() and View#onRestoreInstanceState(Parcelable)

Summary

Public methods

abstract Unit
restoreState(@NonNull savedState: Parcelable)

Restores adapter state

abstract Parcelable

Saves adapter state

Public methods

restoreState

abstract fun restoreState(@NonNull savedState: Parcelable): Unit

Restores adapter state

saveState

@NonNull abstract fun saveState(): Parcelable

Saves adapter state