Search code examples
androidnavigation-drawer

How to close navigation drawer when an item is pressed from it?


Ideally navigation drawer should get closed once some item has been pressed from it, but its not happening automatically. How to do it ? Thanks!


Solution

  • Got it!

    private DrawerLayout mDrawerLayout;
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerLayout.closeDrawers();
    

    Working perfectly fine.