Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onClusterClick method gets passed with a null Cluster (collection) #45

Closed
ericpanorel opened this issue Jan 22, 2014 · 7 comments
Closed
Labels

Comments

@ericpanorel
Copy link

I am encountering instances where the onClusterClick method, gets passed with a null parameter. Similar to the demo app, the cluster parameter below is null, causing the application to crash, when a user clicks the "cluster marker". Another symptom when this issue is happening, is that there are way more "cluster markers" as there should be, i.e. when totally zoomed out (picture below), they are still there, instead of just one marker. I find that this happens, when I am "slowly" zooming in and out a few times. I am pointing to version 0.2.1 (gradle).

My work around right now, is to add a try-catch, at least the App doesn't crash. Any ideas?

@Override
public boolean onClusterClick(Cluster<Person> cluster) {
    // Show a toast with some info when the cluster is clicked.
    String firstName = cluster.getItems().iterator().next().name;
    Toast.makeText(this, cluster.getSize() + " (including " + firstName + ")", Toast.LENGTH_SHORT).show();
    return true;
}

zoomed_out

@broady
Copy link
Contributor

broady commented Jan 22, 2014

Can reproduce this in the demo app? Do you have other markers on the map?

@ericpanorel
Copy link
Author

I haven't tried the demo app, but the code is mostly based from the demo. What do you mean by "other markers"? All markers are solely added via (enhanced for-loop )

 mClusterManager.addItem(m);

if that's what you're asking? There are no "stand-alone" marker additions..

As I have a "refresh" button, it also fixes the "extra clutter" problem, coz it blasts away all markers, and adds them again.

Thanks mate....

@broady
Copy link
Contributor

broady commented Jan 22, 2014

I can't reproduce this with the demo app on 0.2.1. Can you send me a build (or source code?) of your project?

@ericpanorel
Copy link
Author

Sent... Let me know if you didn't get my email.

@ericpanorel
Copy link
Author

After further debugging, I'm afraid this issue might be caused by activity/fragment life cycle management. I update my markers upon receiving them from a LocalBroadcastReceiver. The problem becomes easily reproducible, when I rotate the screen too many times while attempting to zoom out/in in between the rotation - in the zoom range that a lot of markers are visible. In my app, the rotation of the screen, initiates a call to a service, then registers a local broadcast receiver... The onReceive method, updates the map... I caught at one point, the even the getActivity() returns null when the onReceive gets called....

@stale
Copy link

stale bot commented Oct 3, 2019

This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you!

@stale stale bot added the stale label Oct 3, 2019
@stale
Copy link

stale bot commented Nov 2, 2019

Closing this. Please reopen if you believe it should be addressed. Thank you for your contribution.

@stale stale bot closed this as completed Nov 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants