We are drawing polyline according to different zone colors (Different colors assigned to the different zone where the person is in) and the below issue, we are facing constantly. Is anyone know the solution?
Getting issue on line no 8: polyline.setPoints(points) where points contain array of lat/lng. eg:lat/lng: (34.282619,-119.149895) AlexMamo
PolylineOptions options = new PolylineOptions();
Polyline polyline = null;
for (int i = 1; i < coloredPointArrayLit.size(); i++) {
if (coloredPointArrayLit.get(i).color == coloredPointArrayLit.get(i - 1).color) {
if (polyline != null) {
List<LatLng> points = polyline.getPoints();
points.add(coloredPointArrayLit.get(i).coordinates);
polyline.setPoints(points);
} else {
options.add(coloredPointArrayLit.get(i - 1).coordinates);
options.add(coloredPointArrayLit.get(i).coordinates);
options.color(coloredPointArrayLit.get(i).color);
options.jointType(JointType.ROUND);
options.endCap(roundCap);
options.startCap(roundCap);
// Add the polyline to the map colored polyline
polyline = this.googleMap.addPolyline(options
.width(DensityTool.adjustToDensity(context, 7)));
}
} else {
options = new PolylineOptions();
options.add(coloredPointArrayLit.get(i - 1).coordinates);
options.add(coloredPointArrayLit.get(i).coordinates);
polyline = null;
}
}
Any help will be appreciated.
![[![Firebase logs:][1]][1]](https://i.stack.imgur.com/Bgpk5.png)