diff --git a/app/src/main/java/com/uam/wmi/findmytutor/activity/MapActivity.java b/app/src/main/java/com/uam/wmi/findmytutor/activity/MapActivity.java index d742afd..207ba14 100644 --- a/app/src/main/java/com/uam/wmi/findmytutor/activity/MapActivity.java +++ b/app/src/main/java/com/uam/wmi/findmytutor/activity/MapActivity.java @@ -348,12 +348,19 @@ public class MapActivity extends BaseActivity @Override public void onSuccess(List coordsList) { - ArrayList currentCoordsIds = new ArrayList<>(); - for (Coordinate coordinate : coordsList) { - currentCoordsIds.add(coordinate.getUserId()); + if(coordsList.isEmpty()) { + Log.e(tag, "200 empty []"); + mapboxMap.clear(); + return; } -// Set currentCoordsIds = new HashSet(tmp); + + ArrayList tmp = new ArrayList<>(); + for (Coordinate coordinate : coordsList) { + tmp.add(coordinate.getUserId()); + } + + Set currentCoordsIds = new HashSet<>(tmp); if (previousCoordsIds.isEmpty()){ previousCoordsIds.addAll(currentCoordsIds); } else { @@ -366,6 +373,7 @@ public class MapActivity extends BaseActivity coordsMap.remove(toRemoveId); } } else { + // TODO double check when some markers api will change Log.e(tag+ "delete: ","nothing to remove"); } }