title: How to open any fragment after Navigation Drawer closed
body: <p>My Fragment opens immediately after clicking the Navigation Drawer item. I want it to open after the navigation drawer has closed.</p>
  
  <p>How do I open the fragment after the drawer was closed in the Navigation Drawer support library?</p>
  
  <pre><code>private void initNavigationView()
  {
      navigationView = (NavigationView) findViewById(R.id.navigation_view);
      drawerLayout = (DrawerLayout) findViewById(R.id.navigation_drawer);
  
      drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.nav_open, R.string.nav_close) {
          @Override
          public void onDrawerOpened(View drawerView) {
              super.onDrawerOpened(drawerView);
              invalidateOptionsMenu();
          }
  
          @Override
          public void onDrawerClosed(View drawerView) {super.onDrawerClosed(drawerView)
          }
  
      };
      drawerLayout.post(new Runnable() {
              @Override
              public void run() {
                  drawerToggle.syncState();
              }
          });
      drawerToggle.setDrawerIndicatorEnabled(true);
      drawerLayout.setDrawerListener(drawerToggle);
      navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
              @Override
              public boolean onNavigationItemSelected(MenuItem menuItem) {
  
                  switch (menuItem.getItemId()) {
                      case R.id.tentang:
                          break;
                      case R.id.keluar:
                          finish();
                          break;
                  }
                  selectDrawerItem(menuItem);
                  return true;
              }
  
              private void selectDrawerItem(MenuItem menuItem)
              {
                  Fragment fragment = null;
                  Class fragmentClass = null;
  
                  switch (menuItem.getItemId())
                  {
                      case R.id.fragment_home:
                          fragmentClass = com.wahyuapps.benux.fragment.fragmentHome.class;
                          break;
                      case R.id.fragment_distro_linux:
                          fragmentClass = com.wahyuapps.benux.fragment.fragmentDistroLinux.class;
                          break;
                  }
                  try {
                      fragment = (Fragment)fragmentClass.newInstance();
                  }catch(Exception e){
                      e.printStackTrace();
                  }
                  FragmentManager fragmentManager = getSupportFragmentManager();
                  fragmentManager.beginTransaction().replace(R.id.fragment_content, fragment).commit();
                  menuItem.setChecked(true);
                  setTitle(menuItem.getTitle());
                  drawerLayout.closeDrawers();
              }
          });
  }
  </code></pre>
  
  <p>What code do I put on this?
  How to open fragment when the drawer is closed?
  on my case, my fragment got opening after clicking the item. I want opening fragment with some delayed after drawer closed.</p>