AndroidViewModel vs ViewModel

With the introduction of the Android Architecture Components library, several new classes were introduced, including AndroidViewModel and ViewModel. However, I’m having trouble figuring out the difference between these two classes. The documentation succinctly describes AndroidViewModel as follows:

Application context aware ViewModel

I appreciate the brevity, but what exactly does this imply? When should we choose to use AndroidViewModel over ViewModel and vice-versa?

3 Answers
3

Leave a Comment