I am drawing multiple polygons in my app. I created a touch detection listener (Thanks to matiash : Polygon Touch detection Google Map API V2) But how I know which polygon touched? in the detection listener I'm using polygon.getID() but I couldn't set this ID value. it is random. How can I set the ID.
polygon creation :
Polygon bol = myMap.addPolygon(new PolygonOptions()
.strokeColor(Color.argb(100,255,0,0))
.strokeWidth(3)
.geodesic(true)
.zIndex(1)
.clickable(true)
.addAll(koords)
);
and the listener :
myMap.setOnPolygonClickListener(new GoogleMap.OnPolygonClickListener() {
@Override
public void onPolygonClick(Polygon polygon) {
// Handle click ...
}
});