Can anyone suggest how to share a ViewModel within different sections of a Jetpack Compose Navigation? According to the documentation, viewModels should normall
I am curious to know how a ViewModel survives when Activity gets rotated because of that it destroyed and recreated again. Logically If we see then ViewModel ge
I completely confused with compose conception. I have a code @Composable fun HomeScreen(viewModel: HomeViewModel = getViewModel()) { Scaffold { val
Edit: This question is a bit out of date now that Google has given us the ability to scope ViewModel to navigation graphs. The better approach (rather than tryi
I am working with Single viewModel for the Activity and all of it's fragment. So to initialise viewmodel if have to write this setup code in onActivityCreated
I'm learning Android ViewModel now. and I have MainActivity and RegisterActivity which can type name, age, and phone number in there. after typing that informat
Recently, the class StateFlow was introduced as part of Kotlin coroutines. I'm currently trying it and encountered an issue while trying to unit test my ViewMod
Recently, the class StateFlow was introduced as part of Kotlin coroutines. I'm currently trying it and encountered an issue while trying to unit test my ViewMod
Recently I've updated my ViewModel to use new viewModelScope. From its implementation, I see that Dispatchers.Main.immediate is set as the default CoroutineDisp
Recently I've updated my ViewModel to use new viewModelScope. From its implementation, I see that Dispatchers.Main.immediate is set as the default CoroutineDisp
Although it is the same exception, my situation is different from SavedStateProvider with the given key is already registered as I am using Nav-graph Scoped Vie
In Fragment, we can use ViewModel scoped to navigation Graph. private val viewModel: ViewModel by navGraphViewModels(R.id.youNavGraphID) But how to create View
I'm using Navigation Components, I have Fragment A and Fragment B, from Fragment A I send an object to Fragment B with safe args and navigate to it. override f