private void addWaypoints(final SubMenu subMenu) { subMenu.clear(); for (final Waypoint waypoint : geocache.getWaypoints()) { if (waypoint.getCoords() != null) { subMenu .add(Menu.NONE, waypoint.getId(), Menu.NONE, waypoint.getName()) .setOnMenuItemClickListener( new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(final MenuItem item) { callback.onWaypointSelected(waypoint); return true; } }); } } subMenu .add(Menu.NONE, Menu.NONE, Menu.NONE, getContext().getString(R.string.cache)) .setOnMenuItemClickListener( new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(final MenuItem item) { callback.onGeocacheSelected(geocache); return true; } }); }
@Override public void navigate(@NonNull final Activity activity, @NonNull final Waypoint waypoint) { NewMap.startActivityCoords( activity, waypoint.getCoords(), waypoint.getWaypointType(), waypoint.getName()); }