@Override protected void onPostExecute(TreeMap<Float, DropsiteLocation> result) { Log.d("GetDropsiteTask", result.size() + " total locations obtained"); int count = RETURN_COUNT; List<DropsiteLocation> locations = new ArrayList<DropsiteLocation>(); for (Map.Entry<Float, DropsiteLocation> l : result.entrySet()) { locations.add(l.getValue()); // only return a subset of the overall count if (--count == 0) break; } Log.d( "GetDropsitesTask", "Passing " + mGetDropsiteLocationsCompleteListeners.size() + " listeners " + locations.size() + " locations"); // notify all listeners that work is complete for (GetDropsiteLocationsCompleteListener listener : mGetDropsiteLocationsCompleteListeners) { listener.onDropsiteLocationFetchComplete(locations); } }