Top "Android-viewmodel" questions

The ViewModel class is designed to store and manage UI-related data in a lifecycle conscious way.

Does ViewModel survive Activity save and restore?

Instances of the new ViewModel class can survive configuration changes if used in the following fashion: mViewModel = ViewModelProviders.of(this).…

android viewmodel android-architecture-components android-viewmodel view-model-pattern
View models for RecyclerView items

My activity has a Google's ViewModel that fetches some model items. These items are then transformed into adapter items of …

android android-recyclerview android-architecture-components android-viewmodel
Setting up LiveData observer in custom view without LifecycleOwner

I'm trying out the new Android Architecture components and have run into a road block when trying to use the …

android mvvm android-architecture-components android-livedata android-viewmodel
How to read data and listen to changes from Room database in a Service?

i am storing user information in a local room database. In activities and fragments I use AndroidViewModel and LiveData to …

java android android-service android-room android-viewmodel
ViewPager with viewmodel and live data , all 6 tabs data is replaced by last tab data

I am working on a ViewPager with 6 tabs where it has only one fragment TimesListFragment Depending on the arguments passed …

android android-viewpager android-livedata android-viewmodel
Android: ViewModel. Failed to call observer method

I'm using new arch. components from google. I have in Activity Login/Registering Fragments that are managed thanks to FragmentTransaction …

android android-fragments android-lifecycle android-viewmodel
What is ViewModelStore and viewModelStoreOwner?

I am very confused due to this new ViewModelProvider api(ViewModelProviders is deprecated) As with the new changes there are …

android android-fragments android-activity android-viewmodel
lateinit property viewModelFactory has not been initialized in Fragment

I am using dagger 2 (version 2.15) for dependency injection in my android project. Everything works fine except injecting viewModelFactory. I cannot …

android mvvm dependency-injection dagger-2 android-viewmodel
The correct way to obtain a ViewModel instance outside of an Activity or a Fragment

I'm building a location app where I display background locations from a Room database in my MainActivity. I can get …

android android-architecture-components android-viewmodel