Skip to content

Instantly share code, notes, and snippets.

@here-devblog-gists
Created April 21, 2016 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save here-devblog-gists/76785444424f821beeb1adef10394dae to your computer and use it in GitHub Desktop.
Save here-devblog-gists/76785444424f821beeb1adef10394dae to your computer and use it in GitHub Desktop.
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