24

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?

dda
  • 5,760
  • 2
  • 24
  • 34
Simo
  • 1,200
  • 1
  • 14
  • 26

3 Answers3

44

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();
}
Misam
  • 4,230
  • 2
  • 24
  • 43
CommonsWare
  • 954,112
  • 185
  • 2,315
  • 2,367
8

Code could be useful.

drawnCircle = map.addCircle(circle);
drawnCircle.remove();
Jason Sturges
  • 15,787
  • 14
  • 60
  • 77
Selman Kahya
  • 175
  • 2
  • 2
0

Simplest way, you can use : circle.visible(false)