How can we add an object to a marker in the new Google Maps Android API v2?
So if we click on the InfoWindow, we can do something with the obje
You can bind an object within the marker after adding it on the map like:
MarkerOptions markerOptions = new MarkerOptions().position(YOUR_LANG_LAT).title(YOUR_TITLE);
Marker addedMarker = mMap.addMarker(markerOptions);
CustomObject obj = new CustomObject();
addedMarker.setTag(obj);
Then on map click for instance you can retrieve your object as:
mMap.setOnMarkerClickListener(marker -> {
CustomObject obj = (CustomObject) marker.getTag();
return false;
});