String type = types.getString(j); if (type.equals("locality")) { addr.setLocality(component.getString("long_name")); } else if (type.equals("street_number")) { streetNumber = component.getString("long_name");
address.setLocality(a.getString(WIRE_LOCALITY_CITY)); } else if (a.has(WIRE_LOCALITY_TOWN)) { address.setLocality(a.getString(WIRE_LOCALITY_TOWN)); } else if (a.has(WIRE_LOCALITY_VILLAGE)) { address.setLocality(a.getString(WIRE_LOCALITY_VILLAGE));
gAddress.setLocality(jResult.get("city").getAsString()); displayName += ", " + jResult.get("city").getAsString();
gAddress.setLocality(jAddress.get("city").getAsString()); } else if (jAddress.has("town")){ gAddress.setAddressLine(addressIndex++, jAddress.get("town").getAsString()); gAddress.setLocality(jAddress.get("town").getAsString()); } else if (jAddress.has("village")){ gAddress.setAddressLine(addressIndex++, jAddress.get("village").getAsString()); gAddress.setLocality(jAddress.get("village").getAsString());
@Implementation public List<Address> getFromLocation(double latitude, double longitude, int maxResults) throws IOException { wasCalled = true; this.lastLatitude = latitude; this.lastLongitude = longitude; if (shouldSimulateGeocodeException) { throw new IOException("Simulated geocode exception"); } Address address = makeAddress(); address.setAddressLine(0, addressLine1); address.setLocality(city); address.setAdminArea(state); address.setPostalCode(zip); address.setCountryCode(countryCode); return Arrays.asList(address); }
@Implementation public List<Address> getFromLocation(double latitude, double longitude, int maxResults) throws IOException { wasCalled = true; this.lastLatitude = latitude; this.lastLongitude = longitude; if (shouldSimulateGeocodeException) { throw new IOException("Simulated geocode exception"); } Address address = makeAddress(); address.setAddressLine(0, addressLine1); address.setLocality(city); address.setAdminArea(state); address.setPostalCode(zip); address.setCountryCode(countryCode); return oneElementList(address); }
address.setLocality(readUTF(dis)); address.setAdminArea(readUTF(dis)); address.setSubAdminArea(readUTF(dis));
public static android.location.Address toAddress(PersistableBundle persistableBundle) { if (persistableBundle == null) { return null; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { String language = persistableBundle.getString("language"); String country = persistableBundle.getString("country"); String variant = persistableBundle.getString("variant"); Locale addressLocale = new Locale(language, country, variant); android.location.Address address = new android.location.Address(addressLocale); address.setLocality(persistableBundle.getString("locality")); address.setSubLocality(persistableBundle.getString("subLocality")); address.setAdminArea(persistableBundle.getString("adminArea")); address.setSubAdminArea(persistableBundle.getString("subAdminArea")); address.setCountryName(persistableBundle.getString("countryName")); return address; } else { return null; } }
public CustomAddress(Address address) { super(address.getLocale()); for (int i = 0; i <= address.getMaxAddressLineIndex(); i++){ super.setAddressLine(i, address.getAddressLine(i)); } super.setFeatureName(address.getFeatureName()); super.setAdminArea(address.getAdminArea()); super.setSubAdminArea(address.getSubAdminArea()); super.setLocality(address.getLocality()); super.setSubLocality(address.getSubLocality()); super.setThoroughfare(address.getThoroughfare()); super.setSubThoroughfare(address.getSubThoroughfare()); super.setPostalCode(address.getPostalCode()); super.setCountryCode(address.getCountryCode()); super.setCountryName(address.getCountryName()); super.setLatitude(address.getLatitude()); super.setLongitude(address.getLongitude()); super.setPhone(address.getPhone()); super.setUrl(address.getUrl()); super.setExtras(address.getExtras()); }