@Background void geocoderTask(Place place) { showHideLoading(true); try { Address addr = GeoUtils.getFromPlace(place); showHideLoading(false); if (addr == null) { return; } LatLng latLong = new LatLng(addr.getLatitude(), addr.getLongitude()); updateCamera(latLong); } catch (Exception e) { Log.e("ZUP", e.getMessage(), e); Crashlytics.logException(e); } }
@Background void searchTask(String query) { showHideLoading(true); try { Address addr = GeoUtils.search(query, latitude, longitude); showHideLoading(false); if (addr == null || map == null) { return; } CameraPosition p = new CameraPosition.Builder() .target(new LatLng(addr.getLatitude(), addr.getLongitude())) .zoom(16f) .build(); CameraUpdate update = CameraUpdateFactory.newCameraPosition(p); map.animateCamera(update); } catch (Exception e) { Log.e("ZUP", e.getMessage(), e); Crashlytics.logException(e); } }