Skip to content Skip to sidebar Skip to footer

Android Navigation - After Deeplink Navigation To Second Fragment, Open First Fragment In The Same Graph, But From Another Navigation Graph

In my navigation, I have something like this: When I open registrationFragment (in entry_graph) from a deep-link, and finish registration, I am navigated to main_graph (MainFragm

Solution 1:

How do navigate in step#2? I tried the same flow and it worked when I used the code described here.

Basically this is the code

PendingIntentpendingIntent=newNavDeepLinkBuilder(context)
.setGraph(R.navigation.nav_graph)
.setDestination(R.id.android)
.setArguments(args)
.createPendingIntent();

As described in the doc, when you navigate using intent, the back-stack is reset, and populated with the home fragment of each previous graph. Just make sure the required back-stack actually described correctly in the nav_graph xml - each home fragment opens a new indent.

Hope it works for you :)

Post a Comment for "Android Navigation - After Deeplink Navigation To Second Fragment, Open First Fragment In The Same Graph, But From Another Navigation Graph"