https://kotlinlang.org logo
#android
Title
# android
s

Saket Poddar

02/05/2020, 2:20 PM
I am confused about a scenario where there are couple of activities put together, but I want to have single viewmodel for each of the activities instead of keeping each activity with their individual viewmodel. What are pros and cons with this approach?
google 1
g

gian

02/05/2020, 2:21 PM
what do you mean with “put together”?
s

Saket Poddar

02/05/2020, 2:23 PM
In an application, suppose A,B,C are activity and A launches B, B launches C. "put together" i meant in an app...
m

Matti MK

02/05/2020, 2:29 PM
Separation of concerns comes to my mind first
💯 1
Next issues with lifecycles
k

kyleg

02/05/2020, 4:07 PM
Also if they’re using the same viewmodel it’s a code smell they should be fragments not activities, since the concept behind an activity is that it’s a completely separate thing, and if they have a shared VM then that implies they’re actually tightly interwoven and relate to the same process/activity
👍 1
2
s

Saket Poddar

02/06/2020, 7:25 AM
@kyleg Thanks