Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
private class RouteListener implements RouteManager.Listener {
public void onProgress(int percentage) {
// You can use this to display the progress of the route calculation
}
public void onCalculateRouteFinished(RouteManager.Error error, List<RouteResult> routeResult) {
// If the route was calculated successfully
if (error == RouteManager.Error.NONE) {
// Render the route on the map
mapRoute = new MapRoute(routeResult.get(0).getRoute());
map.addMapObject(mapRoute);
int routeLength = routeResult.get(0).getRoute().getLength();
float steps = 2 * (routeLength / 0.8f);
String title = selectedMapMarker.getTitle();
title = String.format(Locale.ENGLISH, "It's %d steps to %s and back!", ((int)steps), title);
selectedMapMarker.setTitle(title);
selectedMapMarker.showInfoBubble();
}
else {
// Display a message indicating route calculation failure
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.