I have Multiple screens as Composable like HomeScr...
# compose
s
I have Multiple screens as Composable like HomeScreen, DashboardScreen, etc and all of them has it's own ViewModel e.g HomeViewModel and I'm using ViewModel as
Copy code
val viewModel: HomeViewModel = viewModel()
in each screen, Do these ViewModels remain in memory all the time because I'm using a Single Activity? and I'm not using Navigation Component
a
it lives as long as
Copy code
AmbientViewModelStoreOwner.current
If you’re not using navigation component, it’s probably scoped to the Activity or Fragment. You can check that value to make sure
☝️ 1