Divya Motiwala
Divya Motiwala

Reputation: 1669

How to show infoWindow for Circle on Google Maps in android

I want to display circles at specific locations on google maps whose radius will be defined at runtime depending on some value.

I could add the circle on map using :

Circle circle = map.addCircle(new CircleOptions()
         .center(result)
         .radius(Double.parseDouble(size)*100)
         .strokeColor(Color.RED)
         .fillColor(Color.BLUE)
         );

When i click on this circle, i need to display an infoWindow same as the one that appears in case of Markers (i.e setting titles and snippets for each one of them and displaying on clicking it).

How to achieve this?

Upvotes: 2

Views: 1080

Answers (1)

MaciejGórski
MaciejGórski

Reputation: 22232

Add a Marker with 0x0 px icon at the same position as Circle.

When user clicks close enough to the center, info window will show for you.

You still have to handle case when user clicks far from the center using OnMapClickListener and calling marker.showInfoWindow().

Upvotes: 1

Related Questions