StateViewModel

open class StateViewModel(stateHandle: SavedStateHandle) : ViewModel

继承这个类可以快速创建具备SaveInstance功能的ViewModel

Constructors

StateViewModel
Link copied to clipboard
fun StateViewModel(stateHandle: SavedStateHandle)

Properties

stateHandle
Link copied to clipboard
var stateHandle: SavedStateHandle

Extensions

stateHandle
Link copied to clipboard
inline fun <V> StateViewModel?.stateHandle(defValue: V? = null, name: String? = null): ReadWriteProperty<StateViewModel, V>
自动根据生命周期使用FragmentActivity.onSaveInstanceState