private void onNavDrawerItemClicked ( final int itemId ) { if ( itemId == mSelectedItem ) { mDrawerLayout . closeDrawer ( GravityCompat . START ) ; return ; } if ( isSpecialItem ( itemId ) ) { goToNavDrawerItem ( itemId ) ; } else { // launch the target Activity after a short delay, to allow the close animation to play mHandler . postDelayed ( new Runnable ( ) { @ Override public void run ( ) { goToNavDrawerItem ( itemId ) ; } } , mConfig . getLaunchDelay ( ) ) ; // change the active item on the list so the user can see the item changed setSelectedNavDrawerItem ( itemId ) ; // fade out the main content // if (mMainContent != null && mConfig.getFadeOutDuration() != -1) { // mMainContent.animate().alpha(0).setDuration(mConfig.getFadeOutDuration()); // } } mDrawerLayout . closeDrawer ( GravityCompat . START ) ; }
Call when a nav drawer item is clicked