MKergall / osmbonuspack

A third-party library of (very) useful additional objects for osmdroid

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ANR with Marker Clustering

Whappens opened this issue · comments

I have ANR using RadiusMarkerClusterer using zoom with 5k+ markers on the map. And it's fine enough (no ANRs) while I use simple FolderOverlay. I see no extra code repeats and suppose, I can't wrap it within a coroutine or something like that to increase performance.

items.forEach { item ->
    val marker = Marker(mapView).apply {
        position = GeoPoint(item.latLng.latitude, item.latLng.longitude)
//            relatedObject = item
    }

    marker.setOnMarkerClickListener { osmMarker, _ ->
        Timber.v("Marker clicked: ${osmMarker.title}")
        true
    }
    cluster.add(marker)
}

Is the ANR occuring when creating markers/cluster, or at drawing, or specifically at a zoom level change ?

Zoom change.

I see no extra code repeats