Reputation: 1022
In my app, I am displaying a circle around the user. When the user moves, the circle has to move accordingly. Right now to perform that task, I am calling the following function in the onLocationChange
method:
public void drawCircleOnMap(GoogleMap googleMap, double lat, double lng) {
if(circle != null) {
circle.remove();
}
circle = googleMap.addCircle(new CircleOptions().center(new LatLng(lat, lng)).radius(CIRCLE_RADIUS)
.fillColor(Color.argb(100,88, 214, 141)).strokeColor(Color.GREEN));
}
However, the problem is, after every update, the circle keeps blinking. I guess deleting itself and then creating a new one. What is the best way to make it go smother?
Upvotes: 2
Views: 1556
Reputation: 2558
You just need to set center property only not remove and draw circle again on position update just set center property like below
circle.setCenter(newlatlng)
Upvotes: 4