title: Navigation drawer android switching betveen fragments?
body: <p>OK,am new with navigation charts and data binding, tried to follow android documentation on this subject but simply can't understand what is going on.This is simply empty activity with nav drawer,but how,for a love of god, i switch to another fragment when i click on some item in nav drawer?</p>
  <pre><code>    public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
  
      private AppBarConfiguration mAppBarConfiguration;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          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, &quot;Replace with your own action&quot;, Snackbar.LENGTH_LONG)
                          .setAction(&quot;Action&quot;, 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_fragment, R.id.nav_gallery_fragment, R.id.nav_slideshow_fragment)
                  .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.main, menu);
          return true;
      }
  
      @Override
      public boolean onSupportNavigateUp() {
          NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
          return NavigationUI.navigateUp(navController, mAppBarConfiguration)
                  || super.onSupportNavigateUp();
      }
  
      @Override
      public boolean onNavigationItemSelected(@NonNull MenuItem item) {
          switch (item.getItemId()) {
              case R.id.pocetni_ekran: {
                  Navigation.findNavController(this, R.id.nav_host_fragment).navigate(R.id.nav_home_fragment);
                  break;
              }
              case R.id.galerija: {
                  Navigation.findNavController(this, R.id.nav_host_fragment).navigate(R.id.nav_gallery_fragment);
                  break;
              }
              case R.id.slajdsou: {
                  Navigation.findNavController(this, R.id.nav_host_fragment).navigate(R.id.nav_slideshow_fragment);
                  break;
              }
          }
          item.setChecked(true);
  return true;
      }
  }
  </code></pre>
  <p>and my mobile navigation xml</p>
  <pre><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_fragment&quot;&gt;
  
      &lt;fragment
          android:id=&quot;@+id/nav_home_fragment&quot;
          android:name=&quot;com.nswd.slajdmeni.ui.home.HomeFragment&quot;
          android:label=&quot;@string/menu_home&quot;
          tools:layout=&quot;@layout/fragment_home&quot;&gt;
  
          &lt;action
              android:id=&quot;@+id/action_HomeFragment_to_HomeSecondFragment&quot;
              app:destination=&quot;@id/nav_gallery_fragment&quot; /&gt;
          &lt;action
              android:id=&quot;@+id/action_nav_home_fragment_to_nav_slideshow_fragment&quot;
              app:destination=&quot;@id/nav_slideshow_fragment&quot; /&gt;
      &lt;/fragment&gt;
  
  
  
      &lt;fragment
          android:id=&quot;@+id/nav_gallery_fragment&quot;
          android:name=&quot;com.nswd.slajdmeni.ui.gallery.GalleryFragment&quot;
          android:label=&quot;@string/menu_gallery&quot;
          tools:layout=&quot;@layout/fragment_gallery&quot; /&gt;
  
      &lt;fragment
          android:id=&quot;@+id/nav_slideshow_fragment&quot;
          android:name=&quot;com.nswd.slajdmeni.ui.slideshow.SlideshowFragment&quot;
          android:label=&quot;@string/menu_slideshow&quot;
          tools:layout=&quot;@layout/fragment_slideshow&quot; /&gt;
  &lt;/navigation&gt;
  </code></pre>
  <p>and my app bar xml</p>
  <pre><code> &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;menu xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      tools:showIn=&quot;navigation_view&quot;&gt;
  
      &lt;group android:checkableBehavior=&quot;single&quot;&gt;
          &lt;item
              android:id=&quot;@+id/pocetni_ekran&quot;
              android:icon=&quot;@drawable/ic_menu_camera&quot;
              android:title=&quot;@string/menu_home&quot; /&gt;
          &lt;item
              android:id=&quot;@+id/galerija&quot;
              android:icon=&quot;@drawable/ic_menu_gallery&quot;
              android:title=&quot;@string/menu_gallery&quot; /&gt;
          &lt;item
              android:id=&quot;@+id/slajdsou&quot;
              android:icon=&quot;@drawable/ic_menu_slideshow&quot;
              android:title=&quot;@string/menu_slideshow&quot; /&gt;
      &lt;/group&gt;
  &lt;/menu&gt;
  </code></pre>
  <p>EDITED:
  posting my main_activity layout:</p>
  <pre><code>&lt;androidx.drawerlayout.widget.DrawerLayout 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/drawer_layout&quot;
  android:layout_width=&quot;match_parent&quot;
  android:layout_height=&quot;match_parent&quot;
  android:fitsSystemWindows=&quot;true&quot;
  tools:openDrawer=&quot;start&quot;&gt;
  
  &lt;com.google.android.material.navigation.NavigationView
      android:id=&quot;@+id/nav_view&quot;
      android:layout_width=&quot;wrap_content&quot;
      android:layout_height=&quot;match_parent&quot;
      android:layout_gravity=&quot;start&quot;
      android:fitsSystemWindows=&quot;true&quot;
      app:headerLayout=&quot;@layout/nav_header_main&quot;
      app:menu=&quot;@menu/activity_main_drawer&quot; /&gt;
  
  &lt;include
      layout=&quot;@layout/app_bar_main&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot; /&gt;
  </code></pre>
  <p>&lt;/androidx.drawerlayout.widget.DrawerLayout&gt;</p>