title: Setting NavGraph programmatically
body: <p>In my activity layout, I have the following <code>NavHostFragment</code>:</p>
  
  <pre><code>&lt;fragment
              android:id="@+id/my_nav_host_fragment"
              android:layout_height="match_parent"
              android:layout_width="match_parent"
              android:name="androidx.navigation.fragment.NavHostFragment"
              app:defaultNavHost="true"
              app:navGraph="@navigation/my_nav_graph" /&gt;
  </code></pre>
  
  <p>My question is how can I set the navGraph programmatically? How can I convert the <code>my_nav_host_fragment</code> view instance in a <code>NavHostFragment</code> instance?</p>