How to uncheck checked items in Navigation View?

Hafez Divandari picture Hafez Divandari · Mar 17, 2016 · Viewed 23.7k times · Source

I know it's possible to highlight a navigation view item by calling setCheckedItem() or return true value in onNavigationItemSelected to display the item as the selected item, but How can I uncheck the checked items of a navigation view?

Answer

arsent picture arsent · Mar 17, 2016

This will uncheck the items:

    int size = mNavigationView.getMenu().size();
    for (int i = 0; i < size; i++) {
        mNavigationView.getMenu().getItem(i).setChecked(false);
    }