AbstractSavedStateViewModelFactory
abstract class AbstractSavedStateViewModelFactory : KeyedFactory
Skeleton of androidx.lifecycle.ViewModelProvider.KeyedFactory that creates SavedStateHandle
for every requested androidx.lifecycle.ViewModel
. The subclasses implement create(String, Class, SavedStateHandle)
to actually instantiate androidx.lifecycle.ViewModel
s.
Summary
Public constructors
|
Constructs this factory.
|
Protected methods
|
abstract T |
Creates a new instance of the given Class .
|
Public constructors
Public methods
create
@NonNull fun <T : ViewModel!> create(@NonNull modelClass: Class<T>): T
Protected methods
create
@NonNull protected abstract fun <T : ViewModel!> create(@NonNull key: String, @NonNull modelClass: Class<T>, @NonNull handle: SavedStateHandle): T
Creates a new instance of the given Class
.
Parameters |
key |
String: a key associated with the requested ViewModel |
modelClass |
String: a Class whose instance is requested |
handle |
String: a handle to saved state associated with the requested ViewModel |
<T> |
String: The type parameter for the ViewModel. |
Return |
T: a newly created ViewModels |