title: How does this new Android studio 3.5 Navigation Drawer sample code run
body: <p>I was learning Android studio and learnt something about navigation drawer.
  Latter I updated my Android Studio to 3.5 version
  Now I see that old codes are gone.
  New code I see as I am a new learner I am totally confused how does this new Code works for fragments,
  Yes I have tried searching but none of them worked
  can someone Help me out with the following code?</p>
  
  <pre><code>    public class HomeActivity extends AppCompatActivity {
  
       private AppBarConfiguration mAppBarConfiguration;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_home);
      Toolbar toolbar = findViewById(R.id.toolbar);
      setSupportActionBar(toolbar);
  
  
  
      FloatingActionButton fab = findViewById(R.id.fab);
      fab.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                      .setAction("Action", null).show();
          }
      });
      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_gallery, R.id.nav_slideshow,
              R.id.nav_tools, 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);
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.home, menu);
      return true;
  }
  
  @Override
  public boolean onSupportNavigateUp() {
      NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
      return NavigationUI.navigateUp(navController, mAppBarConfiguration)
              || super.onSupportNavigateUp();
  }
  }
  </code></pre>
  
  <p>I want after clicking on menu there related fragment to open.</p>