我在"出租车应用程序"标记消失第二次并再次出现 在locationchanged功能 怎么解决这个问题?
@Subscribe(threadMode = ThreadMode.MAIN)
public void onDriversLocationResult(GetDriversLocationResultEvent event) {
if (event.response != ServerResponse.OK)
return;
for (Marker marker : driverMarkers) {
marker.remove();
driverMarkers.remove(marker);
}
for (Driver driver : event.drivers)
addDriverToMap(driver);
}
public void addDriverToMap(Driver driver) {
driverMarkers.add(mMap.addMarker(new MarkerOptions()
.position(new LatLng(driver.getLat(), driver.getLng()))
.rotation(driver.getBearing())
.icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_taxi))));
}