https://kotlinlang.org logo
#android-architecture
Title
# android-architecture
h

Hakob Astvacatryan

07/07/2020, 8:27 PM
Hi guys, I’m using koin for di, I made mistake and put root activity’s viewmodel to activity scope and now viewmodel doesn’t get retained after rotation. The problem I needed to solve by putting viewmodel into activity scope is to allow child viewmodels inject root activity’s viewmodel. Is there way to do that and retain view model?
v

Viktor Petrovski

07/07/2020, 8:30 PM
Have you considered using scopes?
h

Hakob Astvacatryan

07/07/2020, 8:34 PM
As i mentioned i’m using activity scope.
v

Viktor Petrovski

07/07/2020, 8:38 PM
Yeah what I thought is change the activity scope with a custom one.
h

Hakob Astvacatryan

07/08/2020, 8:48 PM
The scope that i want to create practically is the scope of view model of the activity
is there any workaround to do that?
6 Views