Skip to content
Advertisement

Tag: android-mvvm

AlertDialog In MVVM

I am building an app in MVVM pattern and I am using 3 different styles of dialogs(some of them have 2 buttons,some of them 3). Since the AlertDialog refers to the view, I wrote the code in the fragment. I have 3 dialogs in the same fragment and its look kind of messy. My questions: Is this a good practice

Android application with MVVM architecture, writing to local Room database from a Service using MVVM, how should the Service write to the database?

In MVVM we have Activities and Fragments. Fragments and Activities have access to ViewModel. ViewModles have access to Repository. Repository has access to local and online database. I want to build a Service component so that when the application is put on background the Service should continue to write to the local database. This is how my application looks like:

Advertisement