Android bottom navigation issue with DeppLinks and multiple backstack

I’m implementing an application with bottom naviagtion and multiple backstack using latest android navigation component. My goal is to navigate between tow independent graphs using deeplink.

App basic structure:

Tab #1: Root -> A -> B -> C
Tab #2: Root -> D -> E
Tab #3: Root -> F -> G (deeplink: https://test.com)

Navigate from C -> G by calling findNavController().navigate(deepLink = Uri.parse("https://test.com"))

Forward navigation:

The forward navigation goes right, the fragment G is presented and the Tab #3 is selected as current item on the bottom navigation.

Backwars navigation:

Option #1: Clicking the System back button works fine, the fragment C is presented and the Tab #1 is selected.

Option #2: Clicking the Tab #1 does nothing when it should show the C fragment.

PD: Is there another way we can implement tabs switching without deeplink?

Link to example source code

Leave a Comment