Join Slack
if I have three fragments A, B, C and A is the home Fragment, how can I know if I’m coming from B or...
# android-architecture
m
Mohamed Ibrahim
11/25/2020, 2:20 PM
if I have three fragments A, B, C and A is the home Fragment, how can I know if I’m coming from B or C when I press go back to A, using Navigation Component
f
fatih
11/25/2020, 4:00 PM
I haven't seen any api in navigation component but you can use
savedStateHandle
liveData to set the result in B or C and listen in A.
https://developer.android.com/guide/navigation/navigation-programmatic#returning_a_result
Or you can use a shared view model which is scoped to nav graph. If you can give the use case, it would be better
5
Views
Open in Slack
Previous
Next
kotlinlang
A modern programming language that makes developers happier.
Powered by