Created
January 11, 2017 08:33
-
-
Save mizutori/a80dd26031dcb6f32e76d88caa637d2c to your computer and use it in GitHub Desktop.
This file contains hidden or 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 void addPolyline() { | |
ArrayList<Location> locationList = locationService.locationList; | |
if (locationList.size() == 2) { | |
Location fromLocation = locationList.get(0); | |
Location toLocation = locationList.get(1); | |
LatLng from = new LatLng(((fromLocation.getLatitude())), | |
((fromLocation.getLongitude()))); | |
LatLng to = new LatLng(((toLocation.getLatitude())), | |
((toLocation.getLongitude()))); | |
this.runningPathPolyline = map.addPolyline(new PolylineOptions() | |
.add(from, to) | |
.width(polylineWidth).color(Color.parseColor("#801B60FE")).geodesic(true)); | |
} else if (locationList.size() > 2) { | |
Location toLocation = locationList.get(locationList.size() - 1); | |
LatLng to = new LatLng(((toLocation.getLatitude())), | |
((toLocation.getLongitude()))); | |
List<LatLng> points = runningPathPolyline.getPoints(); | |
points.add(to); | |
runningPathPolyline.setPoints(points); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment