Top "Android-viewmodel" questions

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

How to handle onClick or onTouch like events in ViewModel with data binding in MVVM Android

I have gone through many blogs related to MVVM model with Data Binding. As data binding with ViewModel makes it …

android mvvm android-databinding android-viewmodel android-mvvm
How to give same instance of ViewModel to both the Parent and Child fragment

There are two Fragments: ParentFragment and ChildFragment. ChildFragment has been added to a view of the ParentFragment. Now using Dagger2 …

android mvvm dependency-injection dagger android-viewmodel
LiveData not updating when data changes

I'm using LiveData to fetch data from a server and observe it. My onChanged() method just gets called the first …

java android android-architecture-components android-livedata android-viewmodel
Android MVVM: Activity with multiple Fragments - Where to put shared LiveData?

I have an architectural question about the android ViewModels: Let's say that in my App I have an Activity with …

android mvvm android-viewmodel
Navigation with MVVM android

I have an app using Androids ViewModel class and Navigation Component for navigating between fragments. How would I handle navigation …

android mvvm rx-java android-viewmodel android-architecture-navigation
Get an activity's context from view model class

I based my code on an example I found that uses Android Architecture Components and data binding. This is a …

android mvvm android-recyclerview android-databinding android-viewmodel
ViewModelProviders is not working inside my Fragment

This is what I'm trying to do. Set an ArrayList of object inside a Fragment Get that array from an …

android kotlin mvvm fragment android-viewmodel
Android ViewModel and startActivity

I am learning ViewModel and LiveData and, in the process, a doubt arose. What should I do if I need …

android viewmodel android-architecture-components android-viewmodel
ViewModel cannot be instantiated in an Activity

I am trying to instantiate one ViewModel to use across all of my Activity(s). public class LaunchActivity extends Activity { …

android android-layout android-fragments android-viewmodel
Android ViewModel inside Service (Alternative)

I have a service which provides UI that is visible to user most of the time. I was experimenting with …

android mvvm android-livedata android-viewmodel