I have about 200 Polylines on my Map. Now i try to find out witch Polyline the User have Click. But polyline.getId() give me every Time a new random number like PL65 next start of the App PL144 and so on.
Is there any Way to know witch Polyline the user have click ? I must show for every Polyline a Text with rules.
PolylineOptions spss7 = new PolylineOptions()
.add(new LatLng(52.260803, 8.16152))
.add(new LatLng(52.259113, 8.162186))
.add(new LatLng(52.258438, 8.158634))
.color(Color.GREEN)
.geodesic(true);
Polyline psps7 = googleMap.addPolyline(spss7);
psps7.setClickable(true);
PolylineOptions spss8 = new PolylineOptions()
.add(new LatLng(52.3524987, 7.709607499999999))
.add(new LatLng(52.3524921, 7.7098328))
.add(new LatLng(52.3534915, 7.710031300000001))
.color(Color.GREEN)
.geodesic(true);
Polyline psps8 = googleMap.addPolyline(spss8);
psps8.setClickable(true);
}
googleMap.setOnPolylineClickListener(new GoogleMap.OnPolylineClickListener(){
public void onPolylineClick(Polyline polyline) {
int strokeColor = polyline.getColor() ^ 0x0000CC00;
polyline.setColor(strokeColor);
Toast.makeText(getActivity(), "Polyline klick: "+polyline.getId(), Toast.LENGTH_LONG).show();
}