androidx.lifecycle:lifecycle-extensions
Official Description: Android Lifecycle Extensions
CommonsWare’s Notes
This artifact is the home of ViewModelProviders
. This is an older way of obtaining
a ViewModel
scoped to a specific activity or fragment.
ViewModelProviders
is deprecated. Instead:
-
If you are using Kotlin, use the
by viewModels
property delegate, available in theactivity-ktx
andfragment-ktx
artifacts -
If you are using Java, you can create a
ViewModelProvider
directly via its constructor, passing in the activity or fragment to which its viewmodels shoudl be scoped
Documentation
Versions
- Latest Stable: 2.2.0
- Latest Release Candidate: 2.2.0-rc03
- Latest Beta: 2.2.0-beta01
- Latest Alpha: 2.2.0-alpha05