android.support.design.widget.NavigationView.OnNavigationItemSelectedListener Java Examples
The following examples show how to use
android.support.design.widget.NavigationView.OnNavigationItemSelectedListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java From bubble with MIT License | 5 votes |
private void setupNavigationView(NavigationView view) { view.setNavigationItemSelectedListener(new OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem menuItem) { if (mCurrentNavItem == menuItem.getItemId()) { mDrawerLayout.closeDrawers(); return true; } switch (menuItem.getItemId()) { case R.id.drawer_menu_library: setFragment(new LibraryFragment()); break; case R.id.drawer_menu_browser: setFragment(new BrowserFragment()); break; case R.id.drawer_menu_about: setTitle(R.string.menu_about); setFragment(new AboutFragment()); break; } mCurrentNavItem = menuItem.getItemId(); menuItem.setChecked(true); mDrawerLayout.closeDrawers(); return true; } }); }