Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove a circle from Android Google Maps API v2 without clearing map

Tags:

I am drawing a circle on my map like this:

CircleOptions circle=new CircleOptions(); circle.center(centre); circle.strokeColor(0xFFFFA420); circle.strokeWidth(2f); circle.fillColor(0x11FFA420); circle.radius(radius); myMap.addCircle(circle); 

To remove this circle, I am calling myMap.clear(), which removes all items added to the map. The question is how to remove this circle without removing all others items on the map?

like image 345
Simo Avatar asked Mar 18 '13 15:03

Simo


People also ask

How do I get rid of the blue circle on Google Maps?

Click Location Services: click unlock at bottom of window and then deselect Maps. The blue circle vanishes!

How do I delete a circle in Google Earth?

You can hide the placemark by unchecking the box in the Places panel on the left. You can remove a placemark by right-clicking the placemark then selecting 'Delete' in that same Places panel on the left.


1 Answers

Try calling remove() on the Circle object that you get back from addCircle(). For Example

Circle mapCircle; mapCircle = mapView.addCircle(circleOption); 

Now when you want to remove Call this method

if(mapCircle!=null){   mapCircle.remove(); } 
like image 127
CommonsWare Avatar answered Oct 23 '22 12:10

CommonsWare