I read a lot of ViewModel derived from AndroidViewModel, which then requires of course an application reference.
class SomeViewModel(application: Application) : AndroidViewModel(application)
- But why would one do this? It hurts me to see application handed over to ViewModel. What would be an acceptable use case for this?
- If there is any reason to use AndroidViewModel, can one not derive from ViewModel + use dagger2 for the application inject?