1

I have a main fragment with a map, and below the map is a viewpager2 with several tabs/fragments. The tabs show different information depending on user location.

I see 2 possible designs:

  1. One single shared viewmodel with all the data-logic. It's gonna be somewhat big and somewhat messy, because the only shared data among the fragments is the name of the location.
  2. A shared viewmodel parent with the name of the location, and then one viewmodel pr fragment that reads the location from the shared viewmodel parent and then handles the data-logic of the individual fragment.

Or is there a better way to do it?

Thanks

0 Answers0