Hello, is it ok to use a ViewModel for different fragments/activities?
😶 6
u
Umar Saidu
08/11/2021, 11:43 AM
Yes, it will make your code look clean, better and easier to read
👍 1
a
Artur Schwarz
08/11/2021, 12:23 PM
There’s “SharedViewModel” that is exactly used for this purpose
👍 1
Artur Schwarz
08/11/2021, 12:25 PM
Although i would not suggest you to use just one single shared ViewModel for all Activities/Fragments of your app, since this is not their intended use.