previously I use GmapV2 from Android: How to draw route directions google maps API V2 from current location to destination. But now it's not work I got error about that class. How to fix that class?
Asked
Active
Viewed 982 times
0
-
Welcome to SO. Please add any code you have done so far. – Shaun Dec 04 '15 at 03:45
-
Android GMaps service is working as expected. Please paste some code and also the stack trace of the error you are getting. – AniV Dec 04 '15 at 23:35
-
I'm sorry i can't answer earlier. Here code of class GmapV2 – Newbie Dec 20 '15 at 11:39
-
Where? Still don't see it, lol. – Denny Nov 10 '16 at 10:27
1 Answers
0
This code will draw the line from origin to destination.
@Override
public void onDirectionSuccess(Direction direction, String rawBody) {
Log.d("Status", "Success");
Log.d("Direction", "" + direction);
mMap.addMarker(new MarkerOptions().position(origin));
mMap.addMarker(new MarkerOptions().position(destination));
if (waypoints != null){
for (int i = 0; i < waypoints.size(); i++){
mMap.addMarker(new MarkerOptions().position(waypoints.get(i)));
}
}
ArrayList<LatLng> directionPositionList = direction.getRouteList().get(0).getLegList().get(0).getDirectionPoint();
mMap.addPolyline(DirectionConverter.createPolyline(this, directionPositionList, 5, Color.BLUE));
Log.d("Status", "Success 2");
showRoute.setVisibility(View.GONE);
}

Matt Barrera
- 149
- 1
- 8