在我的应用程序中,我有像Uber这样的跟踪选项,在这里我画了折线 从A点到B点,我跟踪当前位置在这里我要删除 从poit A到当前位置的折线从动态像UBER 应用。我怎么能做到这一点,提出任何建议
private List<Polyline> polylines = new ArrayList<Polyline>();
@Override
public void onRoutingSuccess(ArrayList<Route> route, int i) {
if (polylines.size() > 0) {
for (Polyline poly : polylines) {
poly.remove();
}
}
polylines = new ArrayList<>();
//add route(s) to the map.
//In case of more than 5 alternative routes
PolylineOptions polyOptions = new PolylineOptions();
polyOptions.color(getResources().getColor(R.color.btn_green_color));
polyOptions.width(7 + i * 3);
polyOptions.addAll(route.get(0).getPoints());
Polyline polyline = googleMap.addPolyline(polyOptions);
polylines.add(polyline);
if (curentDriverMarker != null) {
curentDriverMarker.remove();
}
if (!base64.equalsIgnoreCase("")) {
curentDriverMarker = googleMap.addMarker(new MarkerOptions()
.position(carPoint)
.icon(BitmapDescriptorFactory.fromBitmap(bmp)));
} else {
curentDriverMarker = googleMap.addMarker(new MarkerOptions()
.position(carPoint)
.icon(BitmapDescriptorFactory.fromResource(R.drawable.point)));
}
}
我想要像这张图片更新折线