public void toggleMenuItem(@Nullable final MenuItem menuItem, final boolean active) {
        if (null != menuItem) {
            if (-1 != stringActiveId && -1 != stringInactiveId) {
                menuItem.setTitle(active ? stringActiveId : stringInactiveId);
            }
            if (-1 != drawableActiveId && -1 != drawableInactiveId) {
                menuItem.setIcon(active ? drawableActiveId : drawableInactiveId);
            }
            if (-1 != hintActiveId && -1 != hintInactiveId && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                menuItem.setTooltipText(CgeoApplication.getInstance().getString(active ? hintActiveId : hintInactiveId));
            }
        }
    }
Encapsulates the mechanism to toggle text and image.
<br>
Supports this for menu-item.
<br>
Class is supposed to be used in Activity to toggle ui-elements.
main/src/main/java/cgeo/geocaching/ui/ToggleItemType.java