AndroidViewModel
open class AndroidViewModel : ViewModel
Application context aware ViewModel
.
Subclasses must have a constructor which accepts Application
as the only parameter.
Summary
Public methods |
open T |
Return the application.
|
Inherited functions |
From class ViewModel
Unit |
onCleared()
This method will be called when this ViewModel is no longer used and will be destroyed.
It is useful when ViewModel observes some data and you need to clear this subscription to prevent a leak of this ViewModel.
|
|
Public constructors
<init>
AndroidViewModel(@NonNull application: Application)
Public methods
getApplication
@NonNull open fun <T : Application!> getApplication(): T
Return the application.