Closed GoogleCodeExporter closed 9 years ago
Hello Tomas,
Can you post relevant code of what you want to achieve and proposition for API
change?
I wouldn't want this lib API to drift too far away from the original library.
Some control questions:
How many markers do you want to add this way?
Are you using clustering with addMarkersDynamically set to true?
Original comment by maciek.g...@gmail.com
on 10 Apr 2013 at 7:25
It was only idea. I have about 5000 markers on the map and I'm using
addMarkersDynamically. Now I make DB query in the background thread and them
already on the UI thread iterate over all rows in the cursor add call
addMarker(). It is relatively fast. I only think that maybe should be faster if
will be possible call addMarker() also from background thread. But it require
some additional method which must be called after all markers will be added to
propagate changes to the map. Now it crash by ConcurrentModificationException.
I have also thought about the possibility to not load (from DB) all markers but
only for square region around displayed area. But I don't know how to do it
fast. Clear all markers after every move it is relatively slow. If I will only
add new ones after every move it will make duplicates or it is handled?
Original comment by tomas.pr...@gmail.com
on 12 Apr 2013 at 8:46
The code is made to not call the original library unless necessary. So when you
add 5000 markers, only a dozen or so are really created in the end.
I have just checked with LaunchTimeTestActivity available in demo project. For
5000 markers with clustering and dynamic addition enabled it takes 180ms
This might be an issue of course, but I don't think adding synchronization to
allow multiple threads access would decrease that.
One thing I can suggest is to add markers in packets using Handler. Take this
as an example:
https://github.com/mg6maciej/android-maps-v2-demo/blob/master/NewMapsDemo/src/pl
/mg6/newmaps/demo/AddMarkersInBackgroundExampleActivity.java
If you don't add all the markers, you can get some improvements, but you need
to be careful not to add same marker twice.
Original comment by maciek.g...@gmail.com
on 12 Apr 2013 at 8:10
Original issue reported on code.google.com by
tomas.pr...@gmail.com
on 10 Apr 2013 at 5:32