title: Using Navigation Component inside BaseFragment
body: <p>In my application I have an OptionsMenu which is used by many Fragments. Therefore I created the following BaseFragment:</p>
  
  <pre><code>abstract class BaseFragment : Fragment() {
  
  private lateinit var navController: NavController
  
  protected fun askForPermissions(permissionRequestCode: Int, vararg permissions: String) {
      requestPermissions(permissions, permissionRequestCode)
  }
  
  protected fun checkPermission(permission: String, activity: Activity): Boolean = when {
      Build.VERSION.SDK_INT &lt; Build.VERSION_CODES.M -&gt; true // It is not needed at all as there were no runtime permissions yet
      else -&gt; ContextCompat.checkSelfPermission(activity, permission) == PackageManager.PERMISSION_GRANTED
  }
  
  override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {
      inflater!!.inflate(R.menu.menu_topbar, menu)
  
      @SuppressLint("RestrictedApi")
      if (menu is MenuBuilder) {
          menu.setOptionalIconsVisible(true)
      }
  
      super.onCreateOptionsMenu(menu, inflater)
  }
  
  override fun onOptionsItemSelected(item: MenuItem): Boolean {
      navController = Navigation.findNavController(view!!)
  
      return when (item.itemId) {
          R.id.menu_topbar_profile -&gt; {
              navController.navigate(actionBaseToProfile())
              true
          }
          R.id.menu_topbar_favorites -&gt; {
              navController.navigate(actionBaseToFavorites())
              true
          }
          R.id.menu_topbar_help -&gt; {
              navController.navigate(actionBaseToHelp())
              true
          }
          else -&gt; false
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>And in the navigation file I added the BaseFragment and the target Fragments. Here is a snippet:</p>
  
  <pre><code>    &lt;fragment
      android:id="@+id/fragment_base"
      android:name="com.test.scanner.base.BaseFragment"&gt;
  
      &lt;action
          android:id="@+id/action_base_to_profile"
          app:destination="@id/fragment_profile" /&gt;
  &lt;/fragment&gt;
  
  &lt;fragment
      android:id="@+id/fragment_profile"
      android:name="com.test.scanner.ui.profile.ProfileFragment"
      tools:layout="@layout/fragment_profile" /&gt;
  </code></pre>
  
  <p>As you can see I don't defined a layout for the BaseFragment because there is no one. I always get an IllegalArgumentException if I want to navigate to a specific screen (e.g. ProfileFragment) by clicking on an element of the OptionsMenu. Here is the exception:</p>
  
  <pre><code>java.lang.IllegalArgumentException: navigation destination com.test.scanner.debug:id/action_base_to_profile is unknown to this NavController
  </code></pre>
  
  <p>How we can use the Navigation Component inside a BaseFragment. Is it possible at all or is there another solution for this case?</p>