Top "Android-viewmodel" questions

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

ViewModelProviders is deprecated in 1.1.0

Looking at the Google docs for ViewModel, they show the below sample code on how to get a ViewModel: val …

android android-gradle-plugin android-architecture-components android-viewmodel
Observing LiveData from ViewModel

I have a separate class in which I handle data fetching (specifically Firebase) and I usually return LiveData objects from …

android android-architecture-components android-livedata android-viewmodel
LiveData update on object field change

I'm using Android MVVM architecture with LiveData. I have an object like this public class User { private String firstName; private …

android observable android-livedata android-viewmodel
AndroidViewModel vs ViewModel

With the introduction of the Android Architecture Components library, several new classes were introduced, including AndroidViewModel and ViewModel. However, I'm …

android mvvm viewmodel android-architecture-components android-viewmodel
LiveData prevent receive the last value when start observing

Is it possible to prevent LiveData receive the last value when start observing? I am considering to use LiveData as …

android android-livedata android-architecture-components android-viewmodel mutablelivedata
Manually clearing an Android ViewModel?

Edit: This question is a bit out of date now that Google has given us the ability to scope ViewModel …

android android-architecture-components android-jetpack android-viewmodel
how to get viewModel by viewModels? (fragment-ktx)

I am working with Single viewModel for the Activity and all of it's fragment. So to initialise viewmodel if have …

android androidx android-jetpack kotlin-android-extensions android-viewmodel
When is the viewmodel onCleared called

Are ViewModels independent of activity/fragment lifecycles or just their configuration changes. When will they cease to exist and the …

android android-activity android-lifecycle android-viewmodel
Cannot create an instance of ViewModel class (Unable to start activity ComponentInfo)

I am using MVVM, Retrofit, LiveData in my project but I get this error before that I saw these links …

android mvvm android-architecture-components android-viewmodel
MediatorLiveData or switchMap transformation with multiple parameters

I am using Transformations.switchMap in my ViewModel so my LiveData collection, observed in my fragment, reacts on changes of …

android observer-pattern android-architecture-components android-livedata android-viewmodel