Hello, is it ok to use a ViewModel for different f...
# android
h
Hello, is it ok to use a ViewModel for different fragments/activities?
😶 6
u
Yes, it will make your code look clean, better and easier to read
👍 1
a
There’s “SharedViewModel” that is exactly used for this purpose
👍 1
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.
👍 1