我正在尝试使用以下方法更新用户位置:
private void addLocationIndicator(GeoCoordinates geoCoordinates,
LocationIndicator.IndicatorStyle indicatorStyle, double orient) {
LocationIndicator locationIndicator = new LocationIndicator();
locationIndicator.setLocationIndicatorStyle(indicatorStyle);
// A LocationIndicator is intended to mark the user's current location,
// including a bearing direction.
// For testing purposes, we create a Location object. Usually, you may want to get this from
// a GPS sensor instead.
Location location = new Location.Builder()
.setCoordinates(geoCoordinates)
.setTimestamp(new Date())
.setBearingInDegrees(orient)
.build();
locationIndicator.updateLocation(location);
// A LocationIndicator listens to the lifecycle of the map view,
// therefore, for example, it will get destroyed when the map view gets destroyed.
mapView.addLifecycleListener(locationIndicator);
}
每当更新位置时,我都必须删除以前的指示符。是否有任何方法可以删除以前的位置指示符,因为当用户更新其位置时,它会叠加在最后一个指示符上?