private PlacesModel getIconsPath(PlacesModel placesModel) { for (PlaceModel placeModel : placesModel.getPlaces()) { if (FoodIconUtils.isIconInCache(context, placeModel.getName())) { placeModel.setIcon(FoodIconUtils.loadFoodIconFromCache(context, placeModel.getName())); } } return placesModel; }
@Override protected void onPostExecute(PlacesModel placesModel) { super.onPostExecute(placesModel); for (PlaceModel placeModel : placesModel.getPlaces()) { final LatLng latLng = new LatLng( placeModel.getLocation().getLatitude(), placeModel.getLocation().getLongitude()); Marker marker = map.addMarker( new MarkerOptions() // here we dont need the marker, deleted if its not going to have // any use .position(latLng) .title(placeModel.getName()) .snippet(placeModel.getVicinity()) .icon( BitmapDescriptorFactory.fromPath( FoodIconUtils.loadFoodIconFromCache(context, placeModel.getName())))); map.moveCamera(CameraUpdateFactory.newCameraPosition(getCameraPositionInMap(latLng))); } onPlacesLoadedListener.arePlacesLoaded(true); }