Skip to content Skip to sidebar Skip to footer

Unease At The End Of Polylines In Map V2

i have a map v2 application with ability to drawing polylines from pinpointed location to user current location fetched from gps. i used google directions in order to get polyline

Solution 1:

As @Cheesebaron states, the best options is adding only one Polyline. I haven't tested it because I don't have an example of your allPoints data, but it could be something like this:

for (intj=0; j < allPoints.length - 1; j++) {
    if (allPoints[j] != null) {
        List<LatLng> test = decodePoly(allPoints[j]);
        Polylineline= googleMap.addPolyline(newPolylineOptions().color(Color.BLUE).geodesic(true).addAll(test));
    }
}

You can also create only one Polyline instead of one Polyline for each allPoints[j]:

PolylineOptionspolylineOptions=newPolylineOptions().color(Color.BLUE).geodesic(true);
for (intj=0; j < allPoints.length - 1; j++) {
    if (allPoints[j] != null) {
        List<LatLng> test = decodePoly(allPoints[j]);
        polylineOptions.addAll(test);
    }
}
Polylineline= googleMap.addPolyline(polylineOptions);

Post a Comment for "Unease At The End Of Polylines In Map V2"