I have 3 polygons within the same map created in the android application
Polygon nordOption = mMap.addPolygon(new PolygonOptions()
.add(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,p40,p41)
.strokeColor(Color.RED));
Polygon centreOption = mMap.addPolygon(new PolygonOptions()
.add(c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16,c17,c18,c19,c20,c21,c22,c23,c24)
.strokeColor(Color.BLUE));
Polygon sudOption = mMap.addPolygon(new PolygonOptions()
.add(s1,s2,s3,s4,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14)
.strokeColor(Color.GREEN));
each one has the click listener activated
nordOption.setClickable(true);
centreOption.setClickable(true);
sudOption.setClickable(true);
The idea is that when you press each polygon, perform a different action, but the only thing I have achieved is to do the same action no matter what polygon you click
mMap.setOnPolygonClickListener(new GoogleMap.OnPolygonClickListener() {
@Override
public void onPolygonClick(Polygon polygon) {
Toast.makeText(getApplication(),"Soy centro",Toast.LENGTH_LONG).show();
}
});