android-maps-utils
android-maps-utils copied to clipboard
With marker and cluster manager, the marker info adapter window got Invalid.
I use the old version 0.6.2 before, when I upgrade to the version 2.2.5, I found that the marker info window not show as before.
The old version shows like this
and the newest version shows just like this
I've try so many times, when the display got be same with old version, the clustermanager click listener will not work. could anybody help?
@ChoungYoung Thanks for the report! This sounds similar to this issue - https://github.com/googlemaps/android-maps-utils/issues/738.
Some possible solutions are presented here: https://github.com/googlemaps/android-maps-utils/issues/738#issuecomment-639644279
tl;dr - you'll need to update your info window adapter to use the following:
clusterManager.getMarkerCollection().setInfoWindowAdapter(...)
In v1 and higher of the library to support multiple features on the map at once the click handlers and other operations must be set on the manager and collection objects within the library. This is because GoogleMap
only supports a single listener for events, so we have to centralize callbacks within the library to manage this.
There is more guidance on migrating to v1 and higher here: https://github.com/googlemaps/android-maps-utils#migration-guide
Could you please take a look and let me know if that solves your issue?
If not, it would be great if you could provide a working example on GitHub that reproduces the issue.
@ChoungYoung Thanks for the report! This sounds similar to this issue - #738.
Some possible solutions are presented here: #738 (comment)
tl;dr - you'll need to update your info window adapter to use the following:
clusterManager.getMarkerCollection().setInfoWindowAdapter(...)
In v1 and higher of the library to support multiple features on the map at once the click handlers and other operations must be set on the manager and collection objects within the library. This is because
GoogleMap
only supports a single listener for events, so we have to centralize callbacks within the library to manage this.There is more guidance on migrating to v1 and higher here: https://github.com/googlemaps/android-maps-utils#migration-guide
Could you please take a look and let me know if that solves your issue?
If not, it would be great if you could provide a working example on GitHub that reproduces the issue.
Does this means I need to add cluster with bikeClusterManager?.clusterMarkerCollection.addMarker(), Actually the marker contains some information like battery state\vehicle type, When click cluster manager I do two things, first, change the display of marker, second, get infomation from network to display a dialog, Does the infowindowadapter satisfied this need.
before cluster marker click
after cluster marker click
Does this means I need to add cluster with bikeClusterManager?.clusterMarkerCollection.addMarker(),
No, cluster items should be added with clusterManager.addItem()
directly.
I'd suggest checking out the demo app to see how the APIs should be used for v1 and higher, specifically the CustomMarkerClusteringDemoActivity, and if you're using more than just the clusterManager from Android Maps Utils, then the MultiLayerDemoActivity too.
Does this means I need to add cluster with bikeClusterManager?.clusterMarkerCollection.addMarker(),
No, cluster items should be added with
clusterManager.addItem()
directly.I'd suggest checking out the demo app to see how the APIs should be used for v1 and higher, specifically the CustomMarkerClusteringDemoActivity, and if you're using more than just the clusterManager from Android Maps Utils, then the MultiLayerDemoActivity too.
I'll try it. Thank you
Hi @ChoungYoung. Did this solve your problem?
I am closing this issue, let me know otherwise.