title: Android Navigation Component : Pass value (arguments) in fragments
body: <h2>What I have done:</h2>
  <p>I have created <strong>Navigation Drawer Activity</strong>, As updated new format of <strong>Navigation Drawer Activity</strong>, As per new Android architecture, I got it with <strong><a href="https://developer.android.com/guide/navigation/navigation-getting-started" rel="nofollow noreferrer">Navigation Component</a></strong> structure.</p>
  <p>The <code>NavigationView</code> code with <code>NavController</code> and <code>NavigationUI</code> is below which is <strong>opening fragment when I click on any navigation item.</strong></p>
  <pre class="lang-java prettyprint-override"><code>DrawerLayout drawer = findViewById(R.id.drawer_layout);
  NavigationView navigationView = findViewById(R.id.nav_view);
  // Passing each menu ID as a set of Ids because each
  // menu should be considered as top level destinations.
  mAppBarConfiguration = new AppBarConfiguration.Builder(
          R.id.nav_home, R.id.nav_profile, R.id.nav_privacy_policy,
          R.id.nav_terms, R.id.nav_contact_us, R.id.nav_share, R.id.nav_send)
          .setDrawerLayout(drawer)
          .build();
  NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
  NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
  NavigationUI.setupWithNavController(navigationView, navController);
  </code></pre>
  <p>This is for <code>nav_host_fragment</code>:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;fragment
      android:id=&quot;@+id/nav_host_fragment&quot;
      android:name=&quot;androidx.navigation.fragment.NavHostFragment&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      app:defaultNavHost=&quot;true&quot;
      app:layout_constraintLeft_toLeftOf=&quot;parent&quot;
      app:layout_constraintRight_toRightOf=&quot;parent&quot;
      app:layout_constraintTop_toTopOf=&quot;parent&quot;
      app:navGraph=&quot;@navigation/mobile_navigation&quot; /&gt;
  </code></pre>
  <p>The navigation is happening using this <code>navigation/mobile_navigation.xml</code></p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;navigation xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:id=&quot;@+id/mobile_navigation&quot;
      app:startDestination=&quot;@+id/nav_home&quot;&gt;
  
      &lt;fragment
          android:id=&quot;@+id/nav_home&quot;
          android:name=&quot;com.sohamerp.marsremedies.fragment.HomeFragment&quot;
          android:label=&quot;@string/menu_home&quot;
          tools:layout=&quot;@layout/fragment_home&quot; /&gt;
  
      &lt;fragment
          android:id=&quot;@+id/nav_profile&quot;
          android:name=&quot;com.sohamerp.marsremedies.fragment.ProfileFragment&quot;
          android:label=&quot;@string/menu_my_profile&quot;
          tools:layout=&quot;@layout/fragment_profile&quot; /&gt;
  
      &lt;fragment
          android:id=&quot;@+id/nav_privacy_policy&quot;
          android:name=&quot;com.sohamerp.marsremedies.fragment.PrivacyPolicyFragment&quot;
          android:label=&quot;@string/menu_privacy_policy&quot;
          tools:layout=&quot;@layout/fragment_privacy_policy&quot; /&gt;
  
      &lt;fragment
          android:id=&quot;@+id/nav_terms&quot;
          android:name=&quot;com.sohamerp.marsremedies.fragment.TermsConditionFragment&quot;
          android:label=&quot;@string/menu_terms&quot;
          tools:layout=&quot;@layout/fragment_terms_condition&quot; /&gt;
  
      &lt;fragment
          android:id=&quot;@+id/nav_contact_us&quot;
          android:name=&quot;com.sohamerp.marsremedies.fragment.ContactUsFragment&quot;
          android:label=&quot;@string/menu_contact_us&quot;
          tools:layout=&quot;@layout/fragment_terms_condition&quot; /&gt;
  
  &lt;/navigation&gt;
  </code></pre>
  <h2>What I want to do:</h2>
  <p>Now I want to pass some values as a bundle (arguments) in Fragment when it's called.</p>
  <p>Scenario: I have two fragments <code>PrivacyPolicyFragment</code> and <code>TermsConditionsFragment</code>, In both fragments, I am just opening links inside WebView accordingly. So When I click on the menu item of <code>Privacy Policy</code>, I will pass a link related to the same.</p>
  <p>In this new structure <code>navigation/mobile_navigation.xml</code> opening fragments, <strong>How can I pass arguments?</strong></p>
  <p>Any help?</p>