Navigation Component: How to pop back to previous destination after navigate to a destination using deep link?

578 Views Asked by At

I navigate to a destination using deep link in another navigation graph

Navigation.findNavController(view).navigate(Uri.parse(link));

And I just want to return to the previous destination.

However, popBackStack() only restart the deep link destination

Navigation.findNavController(view).popBackStack();

How can I return to the previous destination if I insist to use deep link?

1

There are 1 best solutions below

0
sajidjuneja On

Check this. It might help. https://developer.android.com/guide/navigation/navigation-deep-link#explicit

the start destination of the graph also added to the stack. So when you click on the back button, the start destination on the graph coming to the top of the stack.