Dependencies

In theory, you get ViewModel from the android.arch.lifecycle:viewmodel artifact.

In practice, you will want the android.arch.lifecycle:extensions artifact instead. This not only pulls in android.arch.lifecycle:viewmodel for you, but it provides the classes necessary to obtain a ViewModel associated with your activities and fragments.


Prev Table of Contents Next

This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.