I want to hide a menu item in navigation drawer menu and show it depending on the type of the user that is using the application according to code below menu item is returning null:
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open,R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
MenuItem target = (MenuItem)drawer.findViewById(R.id.nav_target);
target.setVisible(false);