I've done as suggested and followed the MultiLayerDemoActivity example, but I still cannot get custom InfoWindows to render if there is a GeoJsonLayer on the map, plus MarkerClickListener does not trigger no matter what.
As in the example, I create MarkerManager, GroundOverlayManager, PolygonManager, PolylineManager and MarkerCollection. All of these are used in the GeoJson constructor, MarkerCollection is used to add the markers to the map... which works.
I have a custom InfoWindowAdapter which renders fine until the GeoJsonLayer is added then it goes back to the default adapter (no other code changes).
MarkerClickListener is added to the map (to be safe) and to the MarkerCollection as in the example... still does not work.
Since there is no documentation to accurately describe how all this is suppose to work with version 1.0.2 I feel sorry for other developers struggling with the same InfoWindowAdapter and MarkerClickListener issues... we are spending too much time fumbling in the dark.
What else is suggested?
Forgot to add that OnInfoWindowClickListener also doesn't work no matter what I do.
Also have several other GoogleMap listeners:
LocationSource
InfoWindowAdapter
OnPolylineClickListener
OnMarkerDragListener
OnMapClickListener
OnInfoWindowLongClickListener
OnInfoWindowClickListener
Where are these assigned to?
What about MapLite... where should markers and listeners be assigned?
None of the demo examples address any of those listeners.
1.0.0 had a couple of breaking changes. When you use a MarkerManager, a couple of the GoogleMap set listeners were overridden and this was introduced since #380 (see: https://github.com/googlemaps/android-maps-utils/blob/master/library/src/main/java/com/google/maps/android/collections/MarkerManager.java#L42...L50). So to address your issues you will have to call setInfoWindowAdapter and setOnMarkerClickListener on each MarkerManager.Collection object.
I agree that documentation can be improved to outline these issues鈥攚ill file a separate issue for that.
I have made those changes... as I reported if there is a GeoJsonLayer or clustering on the map, the custom InfoWindowAdapter no longer shows and marker clicks no longer register. None of the demo examples fully test the gamut of all the possible combinations.
Forget the documentation for now... just get an example working with multiple layers that include custom InfoWindowAdapters and marker listeners to see for yourself.
@ryust I will test that. If you can share code samples to help repro that, that would be helpful and can speed up addressing this issue.
I finally resolved it myself with lots of trial/error...
In addition to the GeoJsonLayer I was using, the app also had GroundOverlays... which was the cause of problems. Apparently, you need to add GroundOverlays to a collection obtained from the GroundOverlayManager.newCollection() method.
Similarly, I also discovered you also had to get a collection from the ClusterManager.getMarkerCollection() method and then add InfoWindowAdapter, MarkerClickListener, MarkerDragListener, and InfoWindowClickListener to it... even though the MarkerManager passed to the ClusterManager constructor already had those assignments.
I am working again (knock on wood). Way too much digging on my part and very confusing on how this is all structured compared to pre-1.0 releases. I'm still not confident I have everything hooked together correctly, particularly on how markers are to be added/removed with/without clustering.
Documentation on this critical change to the library is very important!
This is not at all consistent.
For item click you set it like this:
clusterManager.setOnClusterItemClickListener()
For drag:
clusterManager.getMarkerCollection().setOnMarkerDragListener()
It was very frustrating to track this down - when i saw that the hookup of the listeners is queued on the main thread, I thought there won't be a way to use draggable and ClusterManager, together.
I am having the same issue starting in version 1.0.0.
I am not using any Manager. I only use HeatmapTileProvider and KmlLayer but all my InfoWindowAdapter has stopped working.
I've added a Migration Guide in the README to address some of the questions in this issue. Please have a look and if you are still having trouble or have a use-case that isn't covered there please comment here or open another issue.