title: Issues with Navigation Drawer
body: <p>I am using a <code>Navigation Drawer</code> but having problems running the Navigation Drawer. I have used toast but I am having issues as <code>toast</code> is not showing up and clicking on item not calling the next <code>activity</code>.</p>
  
  <pre><code>    package com.taaam.activities;
  
      import androidx.annotation.NonNull;
      import androidx.appcompat.app.ActionBarDrawerToggle;
      import androidx.appcompat.app.AppCompatActivity;
      import androidx.core.view.GravityCompat;
      import androidx.drawerlayout.widget.DrawerLayout;
  
      import android.content.Intent;
      import android.os.Bundle;
      import android.view.Menu;
      import android.view.MenuItem;
      import android.widget.Toast;
  
      import com.google.android.material.navigation.NavigationView;
      import com.taaam.R;
  
      public class MainActivity extends AppCompatActivity /*implements 
      NavigationView.OnNavigationItemSelectedListener */{
  
      androidx.appcompat.widget.Toolbar toolbar;
      DrawerLayout drawerLayout;
      NavigationView navigationView;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_navigation_drawer);
  
          toolbar = findViewById(R.id.tb_activity_main);
          setSupportActionBar(toolbar);
          drawerLayout = findViewById(R.id.activity_navigation_drawer);
  
          //For Back Key in toolbar
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  
          //For implementing the back key if(id==R.id.home){ finish();}
          navigationView = findViewById(R.id.nv_navigation_view);
         /* navigationView.setNavigationItemSelectedListener(this);*/
  
          ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, 
          R.string.open_drawer, R.string.close_drawer);
          drawerLayout.setDrawerListener(toggle);
  
          toggle.syncState();
          }
  
          @Override
          public void onBackPressed() {
          if (drawerLayout.isDrawerOpen(GravityCompat.START)) {
  
              drawerLayout.closeDrawer(GravityCompat.START);
  
          } else {
              super.onBackPressed();
          }
          }
  
          /*navigationView.setNavigationItemSelectedListener(new 
      NavigationView.OnNavigationItemSelectedListener() {*/
  
      private void setupDrawerContent(NavigationView navigationView) {
      navigationView.setNavigationItemSelectedListener(new 
      NavigationView.OnNavigationItemSelectedListener() {
  
      @Override
          public boolean onNavigationItemSelected (MenuItem menuItem){
  
          int id = menuItem.getItemId();
          menuItem.setChecked(true);
          drawerLayout.closeDrawers();
  
          if (id == R.id.item_order) {
              Toast.makeText(MainActivity.this, "Orders", Toast.LENGTH_LONG).show();
              Intent intent = new Intent(MainActivity.this, Orders.class);
              startActivity(intent);
          } else if (id == R.id.item_notifications) {
              Toast.makeText(getApplicationContext(), "Notifications", Toast.LENGTH_LONG).show();
              Intent intent = new Intent(MainActivity.this, Notifications.class);
              startActivity(intent);
          } else if (id == R.id.item_help) {
              Toast.makeText(getApplicationContext(), "Help", Toast.LENGTH_LONG).show();
              Intent intent = new Intent(MainActivity.this, Help.class);
              startActivity(intent);
          } else if (id == R.id.item_settings) {
              Toast.makeText(getApplicationContext(), "Settings", Toast.LENGTH_LONG).show();
              Intent intent = new Intent(MainActivity.this, Settings.class);
              startActivity(intent);
          } else if (id == R.id.item_faqs) {
              Toast.makeText(getApplicationContext(), "FAQ's", Toast.LENGTH_LONG).show();
              Intent intent = new Intent(MainActivity.this, Faqs.class);
              startActivity(intent);
          } else if (id == R.id.item_contact_us) {
              Toast.makeText(getApplicationContext(), "Contact Us", Toast.LENGTH_LONG).show();
              Intent intent = new Intent(MainActivity.this, ContactUs.class);
              startActivity(intent);
          } else if (id == R.id.item_logout) {
              Toast.makeText(getApplicationContext(), "Logout", Toast.LENGTH_LONG).show();
              Intent intent = new Intent(MainActivity.this, Logout.class);
              startActivity(intent);
          /*switch (id) {
  
              case R.id.item_order:
                  Toast.makeText(getApplicationContext(),"Orders",Toast.LENGTH_LONG).show();
                  Intent intent=new Intent(MainActivity.this,Orders.class);
                  startActivity(intent);
                  break;
  
              case R.id.item_notifications:
                  Toast.makeText(getApplicationContext(),"Notifications",Toast.LENGTH_LONG).show();
                  break;
  
              case R.id.item_help:
                  Toast.makeText(getApplicationContext(),"Help",Toast.LENGTH_LONG).show();
                  break;
  
              case R.id.item_settings:
                  Toast.makeText(getApplicationContext(),"Settings",Toast.LENGTH_LONG).show();
                  break;
  
              case R.id.item_faqs:
                  Toast.makeText(getApplicationContext(),"FAQ's",Toast.LENGTH_LONG).show();
                  break;
  
              case R.id.item_contact_us:
                  Toast.makeText(getApplicationContext(),"Contact Us",Toast.LENGTH_LONG).show();
                  break;
  
              case R.id.item_logout:
                  Toast.makeText(getApplicationContext(),"Logout",Toast.LENGTH_LONG).show();
                  break;*/
          }
          drawerLayout.closeDrawer(GravityCompat.START);
  
          return true;
      }
      });
      }
      }
  </code></pre>
  
  <p>Below is the <code>xml</code> file :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;androidx.drawerlayout.widget.DrawerLayout 
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:id="@+id/activity_navigation_drawer"
  android:fitsSystemWindows="true"
  tools:openDrawer="start"&gt;
  &lt;com.google.android.material.navigation.NavigationView
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:id="@+id/nv_navigation_view"
      android:layout_gravity="start"
      app:headerLayout="@layout/activity_navigation_header"
      app:menu="@menu/activity_navigation_menu"
      android:background="@color/colorGrey"/&gt;
  &lt;include
      layout="@layout/activity_main"/&gt;
  &lt;/androidx.drawerlayout.widget.DrawerLayout&gt;**
  </code></pre>