At the time of multiple data with the help of that I am plotting the polyline with lat and long value. Now when I'm plotting it, I'm to specific the line also because that the time of polyline click I should now the different because maybe the lat and long value will same but some when I will give specific value to that then I can know which lat and long is been click.
PolylineOptions polylineOptions = new PolylineOptions();
polylineOptions.addAll(coordinateList);
polylineOptions.width(10);
polylineOptions.color(Color.parseColor("#800080"));
Polyline line = mMap.addPolyline(polylineOptions);
line.setClickable(true);
coordinateList is the list of lat and long value. But I want to add one specific value to get the the value when it is been clicked.
@Override
public void onPolylineClick(Polyline polyline) {
double latitude = polyline.getPoints().get(0).latitude;
double longitude = polyline.getPoints().get(0).longitude;
}
In click I've come to know the lat and long
How I can set specific value and how I will get on click?
You can maintain a structure (a
Map
for example) to store the data associated to thePolyline
s. For example (storing aString
for eachPolyline
):