I have been working on Android Architecture Components for a while which was introduced in Google IO 2017
One of their Component to avoid configuration changes issue they provide ViewModel
and AndroidViewModel
classes
As per the doc:
AndroidViewModel : Application context aware ViewModel
ViewModel : ViewModels can also be used as a communication layer between different Fragments of an Activity.Each Fragment can acquire the ViewModel
using the same key via their Activity
But for AndoirdViewModel
scenario I can get application context by extending a class to Application class
What is the actual difference between them in Android Development? Because both are attached to Activity/Fragment life cycle only.