title: How to use Android Studio default Navigation Drawer in all Activities
body: <p>How to use the Android default Navigation in other Activities?</p>
  
  <p>I don't want to use the back button.</p>
  
  <p>MainActivity:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity
      implements NavigationView.OnNavigationItemSelectedListener {
  
  TextView tvhead,tv6,tv7,tv8,tv9,tvbottom;
  Typeface schriftart_courier_prime;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
      setSupportActionBar(toolbar);
  
  
      DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
      ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
              this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
      drawer.setDrawerListener(toggle);
      toggle.syncState();
  
      NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
      navigationView.setNavigationItemSelectedListener(this);
  
      FragmentManager fm = getFragmentManager();
      fm.beginTransaction().replace(R.id.content_frame, new MainFragment()).commit();
  }
  
  @Override
  public void onBackPressed() {
      DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
      if (drawer.isDrawerOpen(GravityCompat.START)) {
          drawer.closeDrawer(GravityCompat.START);
      } else {
          super.onBackPressed();
      }
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      // Handle action bar item clicks here. The action bar will
      // automatically handle clicks on the Home/Up button, so long
      // as you specify a parent activity in AndroidManifest.xml.
      int id = item.getItemId();
  
      //noinspection SimplifiableIfStatement
      if (id == R.id.action_about) {
  
          Intent getNameScreenIntent2 = new Intent (this, AboutActivity.class);
  
  
          final int result = 1;
  
          startActivity(getNameScreenIntent2);
  
          return true;
  
          //Actionbar element für später
      }else if (id == R.id.action_phone){
  
      }
  
      return super.onOptionsItemSelected(item);
  }
  
  
  @SuppressWarnings("StatementWithEmptyBody")
  @Override
  public boolean onNavigationItemSelected(MenuItem item) {
  
      FragmentManager fm = getFragmentManager();
  
      int id = item.getItemId();
  
      if (id == R.id.nav_home) {
          fm.beginTransaction().replace(R.id.content_frame, new MainFragment()).commit();
      } else if (id == R.id.nav_experiments) {
  
          Intent getNameScreenIntent = new Intent(this, ExperimentsList.class);
  
          final int result = 1;
  
          startActivity(getNameScreenIntent);
      } else if (id == R.id.nav_website) {
  
          Intent getNameScreenIntent = new Intent(this, Web.class);
  
          final int result = 1;
  
          startActivity(getNameScreenIntent);
      } else if (id == R.id.nav_share) {
  
          Intent share = new Intent(Intent.ACTION_SEND);
          share.setType("text/plain");
          share.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_text));
          startActivity(Intent.createChooser(share, getString(R.string.share_title)));
      }
  
      DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
      drawer.closeDrawer(GravityCompat.START);
      return true;
  }
  </code></pre>