title: Android jetpack component - toast on navigation drawer click
body: <p>I am using navigation jetpack and have set up navigation drawer. Every thing works fine. But the problem is I want to show a toast when user clicks "nav_share" but it is not showing...
  <a href="https://i.stack.imgur.com/zs4dP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zs4dP.png" alt="my nav drawer..i want to show toast when user clicks order history whose id is &quot;nav_share&quot;"></a></p>
  
  <p>here is how i made navigation drawer</p>
  
  <pre><code>DrawerLayout drawer = findViewById(R.id.drawer_layout);
          NavigationView navigationView = findViewById(R.id.nav_view);
  
          navigationView.setNavigationItemSelectedListener(this);
  
          mAppBarConfiguration = new AppBarConfiguration.Builder(
                  R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_plan, R.id.navigation_notifications)
                  .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>my menu for navigation drawer is</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      tools:showIn="navigation_view"&gt;
  
      &lt;group android:checkableBehavior="single"&gt;
          &lt;item
              android:id="@+id/nav_home"
              android:icon="@drawable/ic_menu_camera"
              android:title="@string/menu_home" /&gt;
          &lt;item
              android:id="@+id/nav_gallery"
              android:icon="@drawable/ic_menu_gallery"
              android:title="@string/menu_gallery" /&gt;
          &lt;item
              android:id="@+id/nav_slideshow"
              android:icon="@drawable/ic_menu_slideshow"
              android:title="@string/menu_slideshow" /&gt;
          &lt;item
              android:id="@+id/nav_tools"
              android:icon="@drawable/ic_menu_manage"
              android:title="@string/menu_tools" /&gt;
      &lt;/group&gt;
  
      &lt;item android:title="Communicate"&gt;
          &lt;menu&gt;
              &lt;item
                  android:id="@+id/nav_share"
                  android:icon="@drawable/ic_menu_share"
                  android:title="@string/menu_share" /&gt;
              &lt;item
                  android:id="@+id/nav_send"
                  android:icon="@drawable/ic_menu_send"
                  android:title="@string/menu_send" /&gt;
          &lt;/menu&gt;
      &lt;/item&gt;
  
  &lt;/menu&gt;
  </code></pre>
  
  <p>finally:</p>
  
  <pre><code>@Override
      public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
  
          int id = menuItem.getItemId();
  
          if (id == R.id.nav_share)
              Toast.makeText(LauncherActivity.this, "Click", Toast.LENGTH_SHORT).show();
  
          DrawerLayout drawer = findViewById(R.id.drawer_layout);
          drawer.closeDrawer(GravityCompat.START);
          return true;
      }
  </code></pre>
  
  <p>i want that click toast...i cannot see what am i missing....</p>