public AddressAssert hasNoLatitude() { isNotNull(); assertThat(actual.hasLatitude()) // .overridingErrorMessage("Expected to not have latitude but did.") // .isFalse(); return this; }
public AddressAssert hasLatitude() { isNotNull(); assertThat(actual.hasLatitude()) // .overridingErrorMessage("Expected to have latitude but did not.") // .isTrue(); return this; }
if(Geocoder.isPresent()){ try { String location = "theNameOfTheLocation"; Geocoder gc = new Geocoder(this); List<Address> addresses= gc.getFromLocationName(location, 5); // get the found Address Objects List<LatLng> ll = new ArrayList<LatLng>(addresses.size()); // A list to save the coordinates if they are available for(Address a : addresses){ if(a.hasLatitude() && a.hasLongitude()){ ll.add(new LatLng(a.getLatitude(), a.getLongitude())); } } } catch (IOException e) { // handle the exception } }
public AddressAssert hasNoLatitude() { isNotNull(); assertThat(actual.hasLatitude()) // .overridingErrorMessage("Expected to not have latitude but did.") // .isFalse(); return this; }
public AddressAssert hasLatitude() { isNotNull(); assertThat(actual.hasLatitude()) // .overridingErrorMessage("Expected to have latitude but did not.") // .isTrue(); return this; }
if(addressList != null && addressList.size() > 0) { // location exists Address address = addressList.get(0); System.out.println(address); if(address.hasLatitude() && address.hasLongitude()){ coordinates[0] = address.getLatitude(); coordinates[1] = address.getLongitude(); this.canGetCoordinates = true; this.isLocationValid = true; System.out.println(coordinates[0]); System.out.println(coordinates[1]); } } else { // location does not exist }
List<Address> addressList = geoCoder.getFromLocationName(cityName, 1); Address address = addressList.get(0); if(address.hasLatitude() && address.hasLongitude()){ double selectedLat = address.getLatitude(); double selectedLng = address.getLongitude(); }
if(Geocoder.isPresent()){ try { String location = "MyLocation"; Geocoder gcoder = new Geocoder(this); List<Address> addresses= gcoder.getFromLocationName(location, 5); // get the found Address Objects List<LatLng> ll = new ArrayList<LatLng>(addresses.size()); // A list to save the coordinates if they are available for(Address addr : addresses){ if(addr.hasLatitude() && addr.hasLongitude()){ ll.add(new LatLng(addr.getLatitude(), addr.getLongitude(); } } } catch (IOException e) { // handle the exception } }
Geocoder g = new Geocoder(this); List<Address> addressList = null; String searchRoad = "Insert Road Name Here!"; try { addressList = g.getFromLocationName(searchRoad, 1); } catch (IOException e) { Toast.makeText(this, "Location not found", Toast.LENGTH_SHORT) .show(); e.printStackTrace(); } finally { Address address = addressList.get(0); if (address.hasLatitude() && address.hasLongitude()) { double selectedLat = address.getLatitude(); double selectedLng = address.getLongitude(); LatLng Road = new LatLng(selectedLat, selectedLng); Marker Custom = map.addMarker(new MarkerOptions() .position(searchedRoad).title("Here is the road location") .snippet("Hon the lads")); }