Useful info, thanks. But I'm wondering if there's a way to use the view models to share data between an activity and the fragments it contains, or is it only possible between fragments?
I can't find a way to get an activity to be able to set up a view model that the fragments also use if I need a custom factory. They all seem to need the factory to be provided, which then means that the factory has to be provided via some other means. If there are multiple additional arguments then that is slightly better, but otherwise the shared data might just as well be passed more direclty. Even if the factory is passed it's not clear that the same view model would be used rather than the factory being used to construct separate instances.