How to instantiate ViewModel that extends AndroidViewModel?
问题 I'm following a tutorial where a ViewModel extends an abstract class in order to use coroutines, this is the class that extends: abstract class BaseViewModel(application: Application) : AndroidViewModel(application), CoroutineScope { private val job = Job() override val coroutineContext: CoroutineContext get() = job + Dispatchers.Main override fun onCleared() { super.onCleared() job.cancel() }} And this is the ViewModel: class ViewModel(application: Application) : BaseViewModel(application) {