RecyclerView.Adapter.StateRestorationPolicy


public enum RecyclerView.Adapter.StateRestorationPolicy


Defines how this Adapter wants to restore its state after a view reconstruction (e.g. configuration change).

Summary

Enum Values

ALLOW

Adapter is ready to restore State immediately, RecyclerView will provide the state to the LayoutManager in the next layout pass.

PREVENT

RecyclerView will not restore the state for the Adapter until a call to setStateRestorationPolicy is made with either ALLOW or PREVENT_WHEN_EMPTY.

PREVENT_WHEN_EMPTY

Adapter is ready to restore State when it has more than 0 items.

Public methods

static RecyclerView.Adapter.StateRestorationPolicy

Returns the enum constant of this type with the specified name.

static RecyclerView.Adapter.StateRestorationPolicy[]

Returns an array containing the constants of this enum type, in the order they're declared.

Enum Values

ALLOW

RecyclerView.Adapter.StateRestorationPolicy RecyclerView.Adapter.StateRestorationPolicy.ALLOW

Adapter is ready to restore State immediately, RecyclerView will provide the state to the LayoutManager in the next layout pass.

PREVENT

RecyclerView.Adapter.StateRestorationPolicy RecyclerView.Adapter.StateRestorationPolicy.PREVENT

RecyclerView will not restore the state for the Adapter until a call to setStateRestorationPolicy is made with either ALLOW or PREVENT_WHEN_EMPTY.

PREVENT_WHEN_EMPTY

RecyclerView.Adapter.StateRestorationPolicy RecyclerView.Adapter.StateRestorationPolicy.PREVENT_WHEN_EMPTY

Adapter is ready to restore State when it has more than 0 items. RecyclerView will provide the state to the LayoutManager as soon as the Adapter has 1 or more items.

Public methods

valueOf

Added in 1.2.0
public static RecyclerView.Adapter.StateRestorationPolicy valueOf(String name)

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Returns
RecyclerView.Adapter.StateRestorationPolicy

the enum constant with the specified name

Throws
java.lang.IllegalArgumentException

if this enum type has no constant with the specified name

values

Added in 1.2.0
public static RecyclerView.Adapter.StateRestorationPolicy[] values()

Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants.

Returns
RecyclerView.Adapter.StateRestorationPolicy[]

an array containing the constants of this enum type, in the order they're declared