The below sentence refers to a ViewModel having some member variable that would hold data that has activity context. The reason is because a viewModel may live longer than it’s activity/fragment. Holding reference to them would cause leak.
Caution: A ViewModel
must never reference a view, Lifecycle
, or any class that may hold a reference to the activity context.
In that sense, the example given doesn’t do that. Implementing `lifecycleObserver` doesn’t make one class holding reference to activity context.