https://kotlinlang.org logo
a

Anshulupadhyay03

03/04/2021, 3:29 PM
Hi everyone, I am working on a project where clean architecture is implemented. We have 3 modules app(android library), domain(java-library) , data(java-lib) . I am refactoring it to follow mvvm + livedata and retrofit in kotlin. Now domain and data being (java-lib), I can not use androidx libs (thats what i read). every sample codes i have gone through for mvvm+livedata+retrofit there is only one module i.e. app/presentation (android-lib). Can someone direct me to show how I can implement similar architecture having java modules in my project?
a

Albert Chang

03/04/2021, 4:00 PM
You can't access
ViewModel
or
LiveData
in a java module. If you want to use
ViewModel
, you can create another android module. For
LiveData
, you should definitely check out
StateFlow
as it's better than
LiveData
almost in every way.
a

Anshulupadhyay03

03/04/2021, 5:58 PM
thanks ...will look into it