https://kotlinlang.org logo
Title
f

Francescos

05/19/2022, 4:50 PM
Is it correct that
NavBackStackEntry.savedStateHandle
is a complete different object from the
SavedStateHandle
object injected from Hilt in the corresponding route
ViewModel
?
i

Ian Lake

05/23/2022, 8:21 PM
Yes, they are completely different things
You can have many, many ViewModels with their own separate saved state handles for the same NavBackStackEntry
f

Francescos

05/24/2022, 2:10 PM
Got it. I was trying to handle the result back from another destination (
previousNavBackStackEntry.savedStateHandle.set()
) and I thought I could handle it in the view model through
savedHandleState.getLiveData()
. Anyway. I found your answer to another thread in which you linked the documentation page on how to properly handle a result back (https://developer.android.com/guide/navigation/navigation-programmatic#returning_a_result). Thank you very much for your time.