I have a single activity application with 3 modules - app
, list
& detail
. My activity is in app
module, it's hosting the only NavHostFragment
. All modules have their own navigation graphs. detail
's starting point requires a long parameter. app
's graph is parenting other graphs:
<?xml version="1.0" encoding="utf-8"?>
<navigation
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/nav_main"
app:startDestination="@id/nav_list">
<include app:graph="@navigation/nav_list" />
<include app:graph="@navigation/nav_detail" />
</navigation>
But by default it's disabled to add actions to included graphs on editor:
I can add a global action in xml file which then shows up in editor:
<?xml version="1.0" encoding="utf-8"?>
<navigation
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/nav_main"
app:startDestination="@id/nav_list">
<include app:graph="@navigation/nav_list" />
<include app:graph="@navigation/nav_detail" />
<action
android:id="@+id/action_global_detailFragment"
app:destination="@id/nav_detail" />
</navigation>
I don't want to use global actions but instead add proper action
s which will encapsulate navigation pattern. Nested graphs already contain their navigation logic and only may need input for entry point. I'm not sure if this is not supported and I'm missing something or else why not ? What's the way to navigate between two or more included graphs ?