@SuppressLint("RestrictedApi")
    public static void tintToolbarAndOverflowIcons(@Nullable final Menu menu) {
        if (null == menu) {
            return;
        }
        // Menu might not yet have been initialized due to timing issues, only run if there's at least 1 toolbar item
        boolean anyMenuItemVisible = false;
        for (int i = 0; i < menu.size(); i++) {
            final MenuItemImpl item = (MenuItemImpl) menu.getItem(i);
            anyMenuItemVisible = anyMenuItemVisible || item.isActionButton();
        }
        if (!anyMenuItemVisible) {
            return;
        }
        final Resources res = getThemedContext().getResources();
        tintMenuIcons(menu, res.getColor(R.color.colorIconActionBar), res.getColor(R.color.colorIconMenu));
    }
Sets enabled state for given menu item (without crashing on null item)
main/src/main/java/cgeo/geocaching/utils/MenuUtils.java