public boolean handleContextMenuClick(final MenuItem item, final Action2<Route, Boolean> showElevationChart, final IGeoItemSupplier route, @Nullable final Runnable onDelete) {
        final int id = item.getItemId();
        if (id == R.id.menu_showElevationChart && showElevationChart != null && route instanceof Route) {
            if (dialog != null) {
                dialog.dismiss();
            }
            showElevationChart.call((Route) route, true);
        } else if (id == R.id.menu_edit && isIndividualRoute(route)) {
            activity.startActivityForResult(new Intent(activity, RouteSortActivity.class), REQUEST_SORT_INDIVIDUAL_ROUTE);
        } else if (id == R.id.menu_optimize && isIndividualRoute(route)) {
            final RouteOptimizationHelper roh = new RouteOptimizationHelper(((IndividualRoute) route).getRouteItems());
            roh.start(activity, this::storeAndReloadIndividualRoute);
        } else if (id == R.id.menu_invert_order && isIndividualRoute(route)) {
            final ArrayList<RouteItem> newRouteItems = new ArrayList<>(((IndividualRoute) route).getRouteItems());
            Collections.reverse(newRouteItems);
            storeAndReloadIndividualRoute(newRouteItems);
        } else if (id == R.id.menu_color && !isIndividualRoute(route)) {
            tracks.find(route, (key, routeForThisKey) -> setTrackColor(activity, tracks, key, item, updateTrack));
        } else if (id == R.id.menu_rename) {
            tracks.find(route, (key, routeForThisKey) -> SimpleDialog.ofContext(dialog.getContext())
                    .setTitle(TextParam.text(activity.getString(R.string.routes_tracks_change_name)))
                    .input(new SimpleDialog.InputOptions().setInitialValue(tracks.getDisplayname(key)), newName -> {
                        if (StringUtils.isNotBlank(newName)) {
                            tracks.setDisplayname(key, newName);
                            updateDialogTracks(popup, tracks, null);
                        }
                    }));
        } else if (id == R.id.menu_visibility) {
            final boolean willBeHidden = !route.isHidden();
            route.setHidden(willBeHidden);
            if (isIndividualRoute(route)) {
                reloadIndividualRoute.run();
            } else {
                tracks.find(route, (key, routeForThisKey) -> {
                    updateTrack.updateRoute(key, route, tracks.getColor(key), tracks.getWidth(key));
                    tracks.hide(key, willBeHidden);
                });
            }
            configureVisibility(item, willBeHidden);
        } else if (id == R.id.menu_center) {
            if (route instanceof Route) {
                ((Route) route).setCenter(centerOnPosition);
            } else {
                final Viewport vp = route.getViewport();
                centerOnPosition.centerOnPosition(vp.getCenter().getLatitude(), vp.getCenter().getLongitude(), vp);
            }
        } else if (id == R.id.menu_delete) {
            if (isIndividualRoute(route)) {
                SimpleDialog.of(activity).setTitle(R.string.map_clear_individual_route).setMessage(R.string.map_clear_individual_route_confirm).confirm(() -> {
                    clearIndividualRoute.run();
                    if (onDelete != null) {
                        onDelete.run();
                    }
                });
            } else {
                tracks.find(route, (key, routeForThisKey) -> SimpleDialog.of(activity).setTitle(R.string.map_clear_track).setMessage(TextParam.text(String.format(activity.getString(R.string.map_clear_track_confirm), tracks.getDisplayname(key)))).confirm(() -> {
                    tracks.remove(key);
                    updateTrack.updateRoute(key, null, tracks.getColor(key), tracks.getWidth(key));
                    if (onDelete != null) {
                        onDelete.run();
                    }
                }));
            }
        } else if (id == R.id.menu_refresh && isIndividualRoute(route)) {
            // create list of geocodes contained in individual route (including geocodes for contained waypoints)
            final Set<String> geocodes = new HashSet<>();
            final RouteSegment[] segments = ((Route) route).getSegments();
            for (RouteSegment segment : segments) {
                if (segment != null) {
                    final RouteItem routeItem = segment.getItem();
                    if (routeItem != null) {
                        final String geocode = routeItem.getGeocode();
                        if (StringUtils.isNotBlank(geocode)) {
                            geocodes.add(geocode);
                        }
                    }
                }
            }
            // refresh those caches
            CacheDownloaderService.downloadCaches(activity, geocodes, true, true, null);
        } else if (id == R.id.indivroute_export_route && isIndividualRoute(route)) {
            new IndividualRouteExport(activity, (Route) route, false);
        } else if (id == R.id.indivroute_export_track && isIndividualRoute(route)) {
            new IndividualRouteExport(activity, (Route) route, true);
        } else if (id == R.id.indivroute_load && isIndividualRoute(route)) {
                if (((Route) route).getNumSegments() == 0) {
                    startFileSelectorIndividualRoute();
                } else {
                    SimpleDialog.of(activity).setTitle(R.string.map_load_from_GPX).setMessage(R.string.map_load_individual_route_confirm).confirm(this::startFileSelectorIndividualRoute);
                }
        } else {
            return false;
        }
        return true;
    }
show a popup for track/individual route, opened by using a long-tap on that item on the map
main/src/main/java/cgeo/geocaching/maps/RouteTrackUtils.java