nukeforum
nukeforum

Reputation: 1324

ClusterManager isn't redrawing Markers

I'm trying to use ClusterManager in order to cluster my CustomMapMarkers, but when the marker data changes and I call mClusterManager.cluster(), the pin positions don't change.

Code:

Map Update Method

void updateMap() {
  mClusterManager.clearItems();
  mClusterManager.addItem(data.getMarker(id));
  mClusterManager.cluster();
}

Marker Update Method

CustomMarker processMarkerUpdate(JSONObject json) {
  CustomMarker cm = new CustomMarker(json.optDouble("latitude", 0.0), json.optDouble("longitude",0.0));

  if (json.has("id")) {
    cm.setUid(json.getString("id"));
  } else {
    //If this happens, we stop processing.
    throw new InvalidCMException();
  }

  cm.setLabel(json.optString("label", ""));

  return cm;
}

I've triple checked the coordinates and they are changed in the object, but the marker does not move on the map.

Am I missing a step?

Upvotes: 1

Views: 1783

Answers (1)

nukeforum
nukeforum

Reputation: 1324

I had overridden my Marker implementation's hashCode() method, which was apparently causing the usual replacing functionality of hash-type collections to act wonky. My solution was to remove my custom implementation and work around the need for it.

Upvotes: 2

Related Questions