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

Notify when marker is declustered #51

Open
kaads123 opened this issue Jul 3, 2017 · 4 comments
Open

Notify when marker is declustered #51

kaads123 opened this issue Jul 3, 2017 · 4 comments

Comments

@kaads123
Copy link

kaads123 commented Jul 3, 2017

Is it possible to get callback when marker is being declustered/clustered (showing as single marker or added to cluster)?

My problem is that I need to add more than 2000 markers, with custom icons. Those more than 2000 icons take a lot of memory, and on some devices app crashes. So I would like to generate/set icon only when the marker is being displayed as actual marker and not when I add them to GoogleMap.

Does it make any sense and is this possible?

@vit001
Copy link

vit001 commented Jul 3, 2017

I don't have an answer to your question, but if those 2000 icons are not unique, you can reuse the Bitmapdescriptor among the markers that share it to save memory.

@kaads123
Copy link
Author

kaads123 commented Jul 3, 2017

@vit001 Yes I have implemented LruCache for BitmapDescriptors, but those 2000 icons are unique, that's why it would be great if a feature like this would be available

@zerox1212
Copy link

@kaads123 I can't help with your question, but do you have a link to an example for using LruCache for custom icons (BitmapDescriptors)? I'm trying to optimize my map with over 2000 markers, most of which have the same icon.

@kaads123
Copy link
Author

kaads123 commented Dec 20, 2017

@zerox1212 sure, this should be enough. https://developer.android.com/topic/performance/graphics/cache-bitmap.html
There's also a code sample how to implement it. In the sample it caches Bitmaps, but in your case you will cache BitmapDescriptors. Also in the sample it uses size of Bitmaps in b, you can just provide a number of items in cache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants