title: Navigation component arguments default value
body: <p>In navigation component, While sending arguments from first fragment to second fragment, default values are not getting which set from navigation graph. </p>
  
  <p>Here is my code:</p>
  
  <p><strong>navigation_graph.xml</strong></p>
  
  <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/navigation_graph"
      app:startDestination="@id/firstFragment"&gt;
  
  
      &lt;fragment
          android:id="@+id/firstFragment"
          android:name="com.example.navigationcomponent.FirstFragment"
          android:label="fragment_first"
          tools:layout="@layout/fragment_first" &gt;
          &lt;action
              android:id="@+id/action_firstFragment_to_secondFragment"
              app:destination="@id/secondFragment"
              app:enterAnim="@anim/nav_default_enter_anim" /&gt;
  
          &lt;argument
              android:name="clickFrom"
              app:argType="string"
              android:defaultValue="From First Fragment" /&gt;
          &lt;argument
              android:name="clickFragmentPosition"
              app:argType="integer"
              android:defaultValue="1" /&gt;
  
      &lt;/fragment&gt;
  
      &lt;fragment
          android:id="@+id/secondFragment"
          android:name="com.example.navigationcomponent.SecondFragment"
          android:label="fragment_second"
          tools:layout="@layout/fragment_second" /&gt;
  
  
  &lt;/navigation&gt;
  </code></pre>
  
  <p><strong>FirstFragment:</strong></p>
  
  <pre><code>class FirstFragment : Fragment() {
  
      override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
                                savedInstanceState: Bundle?): View? {
          // Inflate the layout for this fragment
          return inflater.inflate(R.layout.fragment_first, container, false)
      }
  
      override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
          super.onViewCreated(view, savedInstanceState)
  
          val bundle = Bundle()
          bundle.putBoolean("IsFirstFragment", true)
          val navController = Navigation.findNavController(activity!!, R.id.my_nav_host_fragment)
  
          btnNext.setOnClickListener {
              navController.navigate(R.id.action_firstFragment_to_secondFragment, bundle)
          }
      }
  }
  </code></pre>
  
  <p><strong>SecondFragment:</strong></p>
  
  <pre><code>class SecondFragment : Fragment() {
  
      override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
                                savedInstanceState: Bundle?): View? {
          // Inflate the layout for this fragment
          return inflater.inflate(R.layout.fragment_second, container, false)
      }
  
      override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
          super.onViewCreated(view, savedInstanceState)
  
          val isFromFirstFragment = arguments?.getBoolean("IsFirstFragment", false)
          Log.d(TAG, "$isFromFirstFragment")
          Log.d(TAG, "${FirstFragmentArgs.fromBundle(arguments!!).clickFrom} ${FirstFragmentArgs.fromBundle(arguments!!).clickFragmentPosition}")
  
          val navController = Navigation.findNavController(activity!!, R.id.my_nav_host_fragment)
          btnBack.setOnClickListener {
              navController.navigateUp()
          }
  
          navController.addOnDestinationChangedListener { controller, destination, arguments -&gt;
              Log.d("TAG", "${destination.label}");
          }
      }
  
      companion object {
          private const val TAG: String = "SecondFragment"
      }
  }
  </code></pre>
  
  <p>Here while fetching default values in second fragment I am getting Null Pointer Exception </p>
  
  <pre><code>Log.d(TAG, "${FirstFragmentArgs.fromBundle(arguments!!).clickFrom} ${FirstFragmentArgs.fromBundle(arguments!!).clickFragmentPosition}")
  </code></pre>
  
  <p>My Question is, How can I get values of arguments set using <code>navigation_graph.xml</code>? Navigation Graph have auto-generated getter when you re-build the project. Is there any architecture to bind auto generated setters using default value?</p>