belongs to Maven artifact android.arch.lifecycle:viewmodel:1.1.1
ViewModelProvider.AndroidViewModelFactory
public
static
class
ViewModelProvider.AndroidViewModelFactory
extends ViewModelProvider.NewInstanceFactory
java.lang.Object | ||
↳ | android.arch.lifecycle.ViewModelProvider.NewInstanceFactory | |
↳ | android.arch.lifecycle.ViewModelProvider.AndroidViewModelFactory |
ViewModelProvider.Factory
which may create AndroidViewModel
and
ViewModel
, which have an empty constructor.
Summary
Public constructors | |
---|---|
ViewModelProvider.AndroidViewModelFactory(Application application)
Creates a |
Public methods | |
---|---|
<T extends ViewModel>
T
|
create(Class<T> modelClass)
Creates a new instance of the given |
static
ViewModelProvider.AndroidViewModelFactory
|
getInstance(Application application)
Retrieve a singleton instance of AndroidViewModelFactory. |
Inherited methods | |
---|---|
Public constructors
ViewModelProvider.AndroidViewModelFactory
ViewModelProvider.AndroidViewModelFactory (Application application)
Creates a AndroidViewModelFactory
Parameters | |
---|---|
application |
Application : an application to pass in AndroidViewModel
|
Public methods
create
T create (Class<T> modelClass)
Creates a new instance of the given Class
.
Parameters | |
---|---|
modelClass |
Class : a Class whose instance is requested |
Returns | |
---|---|
T |
a newly created ViewModel |
getInstance
ViewModelProvider.AndroidViewModelFactory getInstance (Application application)
Retrieve a singleton instance of AndroidViewModelFactory.
Parameters | |
---|---|
application |
Application : an application to pass in AndroidViewModel |
Returns | |
---|---|
ViewModelProvider.AndroidViewModelFactory |
A valid ViewModelProvider.AndroidViewModelFactory
|
Annotations
Interfaces
Classes
- AndroidViewModel
- Lifecycle
- LifecycleRegistry
- LifecycleService
- LiveData
- LiveDataReactiveStreams
- MediatorLiveData
- MutableLiveData
- ProcessLifecycleOwner
- ServiceLifecycleDispatcher
- Transformations
- ViewModel
- ViewModelProvider
- ViewModelProvider.AndroidViewModelFactory
- ViewModelProvider.NewInstanceFactory
- ViewModelProviders
- ViewModelProviders.DefaultFactory
- ViewModelStore
- ViewModelStores
Enums