ViewModelProviders code example
Example 1: replace ViewModelProviders.of android x
JAVA
replace :
customViewModel = ViewModelProviders.of(this).get(CustomViewModel.class);
with:
customViewModel = new ViewModelProvider(this).get(CustomViewModel.class);
KOTLIN
replace:
customViewModel = ViewModelProviders.of(this).get(CustomViewModel::class.java)
with:
customViewModel = ViewModelProvider(this).get(CustomViewModel::class.java)
Example 2: viewmodelprovider example
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
Example 3: viewmodelprovider example
implementation "android.arch.lifecycle:extensions:1.0.0"annotationProcessor "android.arch.lifecycle:compiler:1.0.0"