Hi there. I have a question concerning `AAC MVVM` ...
# android-architecture
u
Hi there. I have a question concerning
AAC MVVM
implementation. I have an activity with several
view models
, and I need to connect these. Currently I use
activity
as a kind of proxy between them. But that feels wrong. What would be the best way for one
view model
to observe events from other
view model
? Or is it completely wrong way of implementing
MVVM architecture
?
Ah I misread, multiple VM in one view. You could always inject an instance of LiveData (or a subject if you’re using Rx) into each of them and observe those changes
t
I do this what OP says also. I guess one could delegate such connections to another class, but if Activity is light enough & some UI side-effects will be handled anyway then I don’t see what’s wrong with Activity connecting stuff 🤷