Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

ViewModelStores

open class ViewModelStores
kotlin.Any
   ↳ androidx.lifecycle.ViewModelStores

Factory methods for ViewModelStore class.

Summary

Public methods
open static ViewModelStore
of(@NonNull activity: FragmentActivity)

Returns the ViewModelStore of the given activity.

open static ViewModelStore
of(@NonNull fragment: Fragment)

Returns the ViewModelStore of the given fragment.

Public methods

of

@NonNull @MainThread open static fun of(@NonNull activity: FragmentActivity): ViewModelStore

Returns the ViewModelStore of the given activity.

Parameters
activity FragmentActivity: an activity whose ViewModelStore is requested
Return
ViewModelStore: a ViewModelStore

of

@NonNull @MainThread open static fun of(@NonNull fragment: Fragment): ViewModelStore

Returns the ViewModelStore of the given fragment.

Parameters
fragment Fragment: a fragment whose ViewModelStore is requested
Return
ViewModelStore: a ViewModelStore