Package icyllis.modernui.lifecycle
Interface ViewModelStoreOwner
- All Known Implementing Classes:
Fragment
,TestFragment
,TestFragment.FragmentA
,TestFragment.FragmentB
public interface ViewModelStoreOwner
A scope that owns
ViewModelStore
.
A responsibility of an implementation of this interface is to retain owned ViewModelStore
during the configuration changes and call ViewModelStore.clear()
, when this scope is
going to be destroyed.
-
Method Summary
Modifier and TypeMethodDescriptiondefault ViewModelProvider.Factory
Returns the defaultViewModelProvider.Factory
that should be used when no customFactory
is provided to theViewModelProvider
constructors, such asViewModelProvider(ViewModelStoreOwner)
.Returns theViewModelStore
of the provider.
-
Method Details
-
getViewModelStore
Returns theViewModelStore
of the provider.- Returns:
- a
ViewModelStore
-
getDefaultViewModelProviderFactory
Returns the defaultViewModelProvider.Factory
that should be used when no customFactory
is provided to theViewModelProvider
constructors, such asViewModelProvider(ViewModelStoreOwner)
.- Returns:
- a
ViewModelProvider.Factory
-