Search code examples
androidandroid-navigation

How to navigate to a specific fragment from another nav_graph without a "global action"?


I have two navigation graphs:

  • nav_one
    • frag A: start destination
    • frag B
      • connection through frag A
    • frag C
      • connection through frag B
  • nav_two
    • frag X: start destination
    • frag Y
      • connection through frag X
    • frag Z
      • connection through frag C

How can one navigate from a fragment from nav_one to a specific fragment from nav_two without a "global action"?

Example: I want to navigate from frag B to frag Z.


I'd like to highlight that this question does not have any relation to this one



Solution

  • In short, there is no way to do such a thing with navigation actions. You can only navigate directly to it's start destination.

    For more information about, the Android team has just released a video that answers that question. Check out 1:25

    https://www.youtube.com/watch?v=IvFSJVTGDb4