what are the possibilities to add markers dynamically depending on the area of the map which is shown?
I have a lot of markers or let´s say my markers need a lot of performance to be rendered, cause they are custom. I implemented it now, that only 40 markers are drawn when a "camerachange" was fired. So at this time i always render 40 new markers when cameraposition was changed.
I read about runnable and handler, are their more options? Does someone know which of these possibilities is the best, so that ui-thread isn´t blocked?
I would suggest using one of clustering libraries available for Google Maps Android API v2.
Android Maps Extensions apart from clustering can do a lot of work for you. The API is very similar to official Google library.
If you don't want to use clustering at all, you can still achieve your goal with:
Clusterkraf mainly focuses on animated clustering.
Android Maps Utils as of this writing doesn't have clustering merged into the main branch, but you can see clustering branch.
If you want to code it yourself, I can suggest these approaches:
Marker
s only inVisibleRegion
(same thing Android Maps Extensions does when using code above), example from my demo project here: AddOnlyVisibleMarkersExampleActivity.javaMarker
s usingHandler
, example here: AddMarkersInBackgroundExampleActivity.java