android-maps-utils icon indicating copy to clipboard operation
android-maps-utils copied to clipboard

With marker and cluster manager, the marker info adapter window got Invalid.

Open ChoungYoung opened this issue 2 years ago • 4 comments

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 WechatIMG15

and the newest version shows just like this WechatIMG16

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 avatar Sep 22 '21 01:09 ChoungYoung

@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.

barbeau avatar Sep 22 '21 14:09 barbeau

@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 181632360291_ pic

after cluster marker click 171632360290_ pic_副本

ChoungYoung avatar Sep 23 '21 01:09 ChoungYoung

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.

barbeau avatar Sep 23 '21 13:09 barbeau

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

ChoungYoung avatar Sep 24 '21 01:09 ChoungYoung

Hi @ChoungYoung. Did this solve your problem?

I am closing this issue, let me know otherwise.

kikoso avatar Dec 05 '22 07:12 kikoso