title: Is it possible to have dynamic destination in Nested Navigation Graph Android?
body: <p>I have implemented a nested graph in Navigation graph, which is having 2 graphs. In the first graph, there are 3 fragments and in the second graph, there are 2 fragments. Graph 2 is included in graph 1. I want to navigate to (graph 1 step 1) to (graph 2 step 2). We can not define action between two nested fragments. So is there any way by which we can assign the dynamic destination to navigation?</p>
  
  <p><a href="https://i.stack.imgur.com/Tmar7.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/Tmar7.jpg" alt="enter image description here"></a></p>
  
  <blockquote>
    <p>Graph 1</p>
  </blockquote>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;navigation xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/mobile_navigation"
      app:startDestination="@id/dashboardFragment"&gt;
      &lt;fragment
          android:id="@+id/dashboardFragment"
          android:name="com.navigationgraphexample.fragments.DashboardFragment"
          android:label="fragment_dashboard"
          tools:layout="@layout/fragment_dashboard" &gt;
          &lt;action
              android:id="@+id/action_dashboardFragment_to_stepOneFragment2"
              app:destination="@id/stepOneFragment" /&gt;
          &lt;action
              android:id="@+id/action_dashboardFragment_to_sub_nav"
              app:destination="@id/sub_nav" /&gt;
  
      &lt;/fragment&gt;
      &lt;fragment
          android:id="@+id/stepOneFragment"
          android:name="com.navigationgraphexample.fragments.StepOneFragment"
          android:label="fragment_step_one"
          tools:layout="@layout/fragment_step_one"&gt;
          &lt;action
              android:id="@+id/action_stepOneFragment_to_stepTwoFragment"
              app:destination="@id/stepTwoFragment" /&gt;
      &lt;/fragment&gt;
      &lt;fragment
          android:id="@+id/stepTwoFragment"
          android:name="com.navigationgraphexample.fragments.StepTwoFragment"
          android:label="fragment_step_two"
          tools:layout="@layout/fragment_step_two" /&gt;
      &lt;fragment
          android:id="@+id/notificationFragment"
          android:name="com.navigationgraphexample.fragments.NotificationFragment"
          android:label="fragment_notification"
          tools:layout="@layout/fragment_notification" &gt;
          &lt;deepLink
              android:id="@+id/deepLink"
              app:uri="myapp.com/{myargs}"
              /&gt;
          &lt;argument android:name="myargs"
              app:argType="integer"
              android:defaultValue="1" /&gt;
      &lt;/fragment&gt;
      &lt;include app:graph="@navigation/sub_nav" /&gt;
  &lt;/navigation&gt;
  </code></pre>
  
  <blockquote>
    <p>Graph 2</p>
  </blockquote>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;navigation xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/sub_nav"
      app:startDestination="@id/createNewTaskFragment"&gt;
  
      &lt;fragment
          android:id="@+id/listFragment"
          android:name="com.navigationgraphexample.fragments.ListFragment"
          android:label="fragment_list"
          tools:layout="@layout/fragment_list" /&gt;
      &lt;fragment
          android:id="@+id/createNewTaskFragment"
          android:name="com.navigationgraphexample.fragments.CreateNewTaskFragment"
          android:label="fragment_create_new_task"
          tools:layout="@layout/fragment_create_new_task" &gt;
          &lt;action
              android:id="@+id/action_createNewTaskFragment_to_listFragment"
              app:destination="@id/listFragment" /&gt;
      &lt;/fragment&gt;
  &lt;/navigation&gt;
  </code></pre>
  
  <p>I have checked <a href="https://stackoverflow.com/questions/51173002/how-to-change-start-destination-of-a-navigation-graph-programmatically-jet-pac">this</a> solution but it is not for the nested graph!</p>