Created
April 21, 2016 13:55
-
-
Save here-devblog-gists/76785444424f821beeb1adef10394dae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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