@Override
    public boolean onOptionsItemSelected(final MenuItem item) {
        final int menuItem = item.getItemId();
        if (menuItem == R.id.menu_show_on_map) {
            goMap();
        } else if (menuItem == R.id.menu_switch_select_mode) {
            adapter.switchSelectMode();
            updateSelectSwitchMenuItem(item);
            invalidateOptionsMenuCompatible();
        } else if (menuItem == R.id.menu_refresh_stored) {
            refreshInBackground(adapter.getCheckedOrAllCaches());
            invalidateOptionsMenuCompatible();
        } else if (menuItem == R.id.menu_add_to_route) {
            appendInBackground(adapter.getCheckedOrAllCaches());
            invalidateOptionsMenuCompatible();
        } else if (menuItem == R.id.menu_drop_caches) {
            deleteCaches(adapter.getCheckedOrAllCaches(), false);
            invalidateOptionsMenuCompatible();
        } else if (menuItem == R.id.menu_drop_caches_all_lists) {
            deleteCaches(adapter.getCheckedOrAllCaches(), true);
            invalidateOptionsMenuCompatible();
        } else if (menuItem == R.id.menu_import_pq) {
            checkForEmtpyList = false;
            startListSelection(REQUEST_CODE_IMPORT_PQ);
            invalidateOptionsMenuCompatible();
        } else if (menuItem == R.id.menu_bookmarklists) {
            checkForEmtpyList = false;
            startListSelection(REQUEST_CODE_IMPORT_BOOKMARK);
            invalidateOptionsMenuCompatible();
        } else if (menuItem == R.id.menu_import_gpx) {
            importGpxSelectFiles();
            invalidateOptionsMenuCompatible();
        } else if (menuItem == R.id.menu_create_list) {
            new StoredList.UserInterface(this).promptForListCreation(getListSwitchingRunnable(), StringUtils.EMPTY);
            refreshActionBarTitle();
            invalidateOptionsMenuCompatible();
        } else if (menuItem == R.id.menu_drop_list) {
            removeList();
            invalidateOptionsMenuCompatible();
        } else if (menuItem == R.id.menu_rename_list) {
            renameList();
        } else if (menuItem == R.id.menu_rename_list_prefix) {
            new StoredList.UserInterface(this).promptForListPrefixRename(() -> {
                refreshCurrentList();
                invalidateOptionsMenuCompatible();
            });
        } else if (menuItem == R.id.menu_invert_selection) {
            adapter.invertSelection();
            invalidateOptionsMenuCompatible();
        } else if (menuItem == R.id.menu_select_next20) {
            adapter.selectNextCaches(20);
        } else if (menuItem == R.id.menu_select_next100) {
            adapter.selectNextCaches(100);
        } else if (menuItem == R.id.menu_filter) {
            showFilterMenu();
        } else if (menuItem == R.id.menu_sort) {
            openSortDialog();
        } else if (menuItem == R.id.menu_import_web) {
            importWeb();
        } else if (menuItem == R.id.menu_export_gpx) {
            new GpxExport().export(adapter.getCheckedOrAllCaches(), this, title);
        } else if (menuItem == R.id.menu_export_fieldnotes) {
            new FieldNoteExport().export(adapter.getCheckedOrAllCaches(), this);
        } else if (menuItem == R.id.menu_export_persnotes) {
            new PersonalNoteExport().export(adapter.getCheckedOrAllCaches(), this);
        } else if (menuItem == R.id.menu_upload_modifiedcoords) {
            final Activity that = this;
            SimpleDialog.of(this).setTitle(R.string.caches_upload_modifiedcoords).setMessage(R.string.caches_upload_modifiedcoords_warning).confirm(() -> new BatchUploadModifiedCoordinates(true).export(adapter.getCheckedOrAllCaches(), that));
        } else if (menuItem == R.id.menu_upload_allcoords) {
            final Activity that2 = this;
            SimpleDialog.of(this).setTitle(R.string.caches_upload_allcoords_dialogtitle).setMessage(R.string.caches_upload_allcoords_warning).confirm(() -> new BatchUploadModifiedCoordinates(false).export(adapter.getCheckedOrAllCaches(), that2));
        } else if (menuItem == R.id.menu_remove_from_history) {
            removeFromHistoryCheck();
            invalidateOptionsMenuCompatible();
        } else if (menuItem == R.id.menu_move_to_list) {
            moveCachesToOtherList(adapter.getCheckedOrAllCaches());
            invalidateOptionsMenuCompatible();
        } else if (menuItem == R.id.menu_copy_to_list) {
            copyCachesToOtherList(adapter.getCheckedOrAllCaches());
            invalidateOptionsMenuCompatible();
        } else if (menuItem == R.id.menu_delete_events) {
            deletePastEvents(adapter.getCheckedOrAllCaches());
            invalidateOptionsMenuCompatible();
        } else if (menuItem == R.id.menu_create_internal_cache) {
            InternalConnector.interactiveCreateCache(this, coords, StoredList.getConcreteList(listId), false);
        } else if (menuItem == R.id.menu_clear_offline_logs) {
            clearOfflineLogs(adapter.getCheckedOrAllCaches());
            invalidateOptionsMenuCompatible();
        } else if (menuItem == R.id.menu_show_attributes) {
            adapter.showAttributes(adapter.getCheckedOrAllCaches());
        } else if (menuItem == R.id.menu_make_list_unique || menuItem == R.id.menu_remove_from_other_lists) {
            new MakeListUniqueCommand(this, listId, Geocache.getGeocodes(menuItem == R.id.menu_remove_from_other_lists ? adapter.getCheckedOrAllCaches() : new ArrayList<>())) {

                @Override
                protected void onFinished() {
                    refreshActionBarTitle();
                }

                @Override
                protected void onFinishedUndo() {
                    refreshActionBarTitle();
                }

            }.execute();
        } else if (menuItem == R.id.menu_upload_bookmarklist) {
            BookmarkUtils.askAndUploadCachesToBookmarkList(this, adapter.getCheckedOrAllCaches());
        } else if (menuItem == R.id.menu_set_listmarker) {
            EmojiUtils.selectEmojiPopup(this, markerId, null, this::setListMarker);
        } else if (menuItem == R.id.menu_set_cache_icon) {
            EmojiUtils.selectEmojiPopup(this, -1, null, this::setCacheIcons);
        } else if (menuItem == R.id.menu_set_askfordeletion) {
            setPreventAskForDeletion(false);
        } else {
            return super.onOptionsItemSelected(item);
        }
        return true;
    }
Menu items which are not at all usable with the current list type should be hidden.
Menu items which are usable with the current list type but not in the current situation should be disabled.
main/src/main/java/cgeo/geocaching/CacheListActivity.java