I think you should first get the menu like this:
navigationView.getMenu().findItem(R.id.login).setVisible(false);
The main aspect of this code is calling navigationView.getMenu() to get the menu from this you will have a reference of current inflated menu and call findViewById() and after that you can whatever you what.
For Group of item ex:-
...
and then you can control this using :-
navigationView.getMenu().setGroupVisible(R.id.group_1, true)