The problem is quite straightforward. The question is in context of using ViewModels, LiveData and other related Lifecycle aware arch approaches.
I have an Activity with Na
First there is no harm in having multiple ViewModel
's for a single View.
I would think about my ViewModel's like what kind of data is getting and manipulating, and group them in a way, that seems natural.
For your case, if the fragments and the activity's logic is very similar, I think you can go with a single ViewModel
, but I would avoid that.
What I would do is break the activity's ViewModel
into smaller parts and reuse the proper ViewModel
's in my Fragments
, so that I wouldn't have a God ViewModel, nor roughly the same code in different ViewModel's.