Showing posts with label navigationview. Show all posts
Showing posts with label navigationview. Show all posts
If you are trying to select an Item of the Navigation drawer in the onCreate Method or anywhere else in your application, you can use the code below:

navigationView.getMenu().getItem(0).setChecked(true); 

The getItem(int index) method gets the MenuItem then you can call the setChecked(true);on that MenuItem, all you are left to do is to find out which element index does the default have, and replace the 0 with that index.

You can select(highlight) the item by calling

    onNavigationItemSelected(navigationView.getMenu().getItem(0));