ViewModelProviders is deprecated in 1.1.0

I use lifecycle-extensions 2.2.0 version: implementation “androidx.lifecycle:lifecycle-extensions:2.2.0” It should work, using ViewModelProvider constructor. // With ViewModelFactory val viewModel = ViewModelProvider(this, YourViewModelFactory).get(YourViewModel::class.java) //Without ViewModelFactory val viewModel = ViewModelProvider(this).get(YourViewModel::class.java) 2020/5/15 Update I found another elegant way to achieve this, Android KTX can help implementation “androidx.fragment:fragment-ktx:1.2.4” val viewmodel: MYViewModel by viewModels() val viewmodel: MYViewModel by viewModels { myFactory … Read more

AndroidViewModel vs ViewModel

AndroidViewModel provides Application context If you need to use context inside your Viewmodel you should use AndroidViewModel (AVM), because it contains the application context. To retrieve the context call getApplication(), otherwise use the regular ViewModel (VM). AndroidViewModel has application context. We all know having static context instance is evil as it can cause memory leaks!! … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)