Reputation: 185
I am doing navigation component codelab. In 10 part we add deeplink widget.
I replace destination to R.id.flow_step_two_dest
val custAtgs = FlowStepFragmentArgs(2)
val pendingIntent = NavDeepLinkBuilder(context)
.setGraph(R.navigation.mobile_navigation)
.setDestination(R.id.flow_step_two_dest)
.setArguments(custAtgs.toBundle())
.createPendingIntent()
And have this graph
It works. After press back it is returned to home, but I expect that it will return to Step One.
Is it right behavior? Or am I doing something wrong?
Upvotes: 2
Views: 2513
Reputation: 6966
It is the intended behavior.
This is from step 10 :
The backstack is generated using the destinations specified with app:startDestination. In this app we only have one activity and one level of navigation, so the backstack will take you to the home_dest destination.
Pressing the back button should take you back to home_dest
.
More complicated navigation can include nested navigation graphs. The app:startDestination at each level of the nested graphs determines the backstack.
Wrap flow_step_one_dest
and flow_step_two_dest
into a nested graph and set flow_step_one_dest
as the start destination.
Pressing the back button should take you back to flow_step_one_dest
then home_dest
.
Upvotes: 3