@SuppressWarnings("unchecked") @Override protected void onPostExecute(Object result) { if (result instanceof Exception) { RestClient.reportError(Maps2Activity.this, result); return; } ArrayList<HostBriefInfo> hosts = (ArrayList<HostBriefInfo>) result; if (hosts.isEmpty()) { sendMessage((String) getResources().getText(R.string.no_results), false); } for (HostBriefInfo host : hosts) { HostBriefInfo v = mHosts.putIfAbsent(host.getId(), host); // Only add to the cluster if it wasn't in mHosts before. if (v == null) { mClusterManager.addItem(host); } } mClusterManager.cluster(); }