MVVM View Models vs Jetpack ViewModels

Before you get started on your new project, a note about terminology: The view model that is a part of MVVM is not the same as the Jetpack ViewModel class that you learned about in Chapter 4 and Chapter 9. To avoid confusion, we will always format the name of the Jetpack class as “ViewModel” and the MVVM concept as “view model.”

Recall that the Jetpack ViewModel is a specific class for maintaining data in fragments and activities, even across their volatile lifecycles. The view model in MVVM is a more conceptual part of the architecture. View models may be implemented using Jetpack ViewModels, but – as you will see through most of this chapter – they can also be implemented without using the

Get Android Programming: The Big Nerd Ranch Guide, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.