android.location.Address.setLocality()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中android.location.Address.setLocality()方法的一些代码示例,展示了Address.setLocality()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Address.setLocality()方法的具体详情如下:
包路径:android.location.Address
类名称:Address
方法名:setLocality

Address.setLocality介绍

暂无

代码示例

代码示例来源:origin: sytolk/TaxiAndroidOpen

  1. String type = types.getString(j);
  2. if (type.equals("locality")) {
  3. addr.setLocality(component.getString("long_name"));
  4. } else if (type.equals("street_number")) {
  5. streetNumber = component.getString("long_name");

代码示例来源:origin: thuryn/your-local-weather

  1. address.setLocality(a.getString(WIRE_LOCALITY_CITY));
  2. } else if (a.has(WIRE_LOCALITY_TOWN)) {
  3. address.setLocality(a.getString(WIRE_LOCALITY_TOWN));
  4. } else if (a.has(WIRE_LOCALITY_VILLAGE)) {
  5. address.setLocality(a.getString(WIRE_LOCALITY_VILLAGE));

代码示例来源:origin: MKergall/osmbonuspack

  1. gAddress.setLocality(jResult.get("city").getAsString());
  2. displayName += ", " + jResult.get("city").getAsString();

代码示例来源:origin: MKergall/osmbonuspack

  1. gAddress.setLocality(jAddress.get("city").getAsString());
  2. } else if (jAddress.has("town")){
  3. gAddress.setAddressLine(addressIndex++, jAddress.get("town").getAsString());
  4. gAddress.setLocality(jAddress.get("town").getAsString());
  5. } else if (jAddress.has("village")){
  6. gAddress.setAddressLine(addressIndex++, jAddress.get("village").getAsString());
  7. gAddress.setLocality(jAddress.get("village").getAsString());

代码示例来源:origin: org.robolectric/shadows-maps

  1. @Implementation
  2. public List<Address> getFromLocation(double latitude, double longitude, int maxResults) throws IOException {
  3. wasCalled = true;
  4. this.lastLatitude = latitude;
  5. this.lastLongitude = longitude;
  6. if (shouldSimulateGeocodeException) {
  7. throw new IOException("Simulated geocode exception");
  8. }
  9. Address address = makeAddress();
  10. address.setAddressLine(0, addressLine1);
  11. address.setLocality(city);
  12. address.setAdminArea(state);
  13. address.setPostalCode(zip);
  14. address.setCountryCode(countryCode);
  15. return Arrays.asList(address);
  16. }

代码示例来源:origin: com.github.japgolly.android.test/robolectric

  1. @Implementation
  2. public List<Address> getFromLocation(double latitude, double longitude, int maxResults) throws IOException {
  3. wasCalled = true;
  4. this.lastLatitude = latitude;
  5. this.lastLongitude = longitude;
  6. if (shouldSimulateGeocodeException) {
  7. throw new IOException("Simulated geocode exception");
  8. }
  9. Address address = makeAddress();
  10. address.setAddressLine(0, addressLine1);
  11. address.setLocality(city);
  12. address.setAdminArea(state);
  13. address.setPostalCode(zip);
  14. address.setCountryCode(countryCode);
  15. return oneElementList(address);
  16. }

代码示例来源:origin: grzegorznittner/chanu

  1. address.setLocality(readUTF(dis));
  2. address.setAdminArea(readUTF(dis));
  3. address.setSubAdminArea(readUTF(dis));

代码示例来源:origin: thuryn/your-local-weather

  1. public static android.location.Address toAddress(PersistableBundle persistableBundle) {
  2. if (persistableBundle == null) {
  3. return null;
  4. }
  5. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
  6. String language = persistableBundle.getString("language");
  7. String country = persistableBundle.getString("country");
  8. String variant = persistableBundle.getString("variant");
  9. Locale addressLocale = new Locale(language, country, variant);
  10. android.location.Address address = new android.location.Address(addressLocale);
  11. address.setLocality(persistableBundle.getString("locality"));
  12. address.setSubLocality(persistableBundle.getString("subLocality"));
  13. address.setAdminArea(persistableBundle.getString("adminArea"));
  14. address.setSubAdminArea(persistableBundle.getString("subAdminArea"));
  15. address.setCountryName(persistableBundle.getString("countryName"));
  16. return address;
  17. } else {
  18. return null;
  19. }
  20. }

代码示例来源:origin: CUTR-at-USF/OpenTripPlanner-for-Android

  1. public CustomAddress(Address address) {
  2. super(address.getLocale());
  3. for (int i = 0; i <= address.getMaxAddressLineIndex(); i++){
  4. super.setAddressLine(i, address.getAddressLine(i));
  5. }
  6. super.setFeatureName(address.getFeatureName());
  7. super.setAdminArea(address.getAdminArea());
  8. super.setSubAdminArea(address.getSubAdminArea());
  9. super.setLocality(address.getLocality());
  10. super.setSubLocality(address.getSubLocality());
  11. super.setThoroughfare(address.getThoroughfare());
  12. super.setSubThoroughfare(address.getSubThoroughfare());
  13. super.setPostalCode(address.getPostalCode());
  14. super.setCountryCode(address.getCountryCode());
  15. super.setCountryName(address.getCountryName());
  16. super.setLatitude(address.getLatitude());
  17. super.setLongitude(address.getLongitude());
  18. super.setPhone(address.getPhone());
  19. super.setUrl(address.getUrl());
  20. super.setExtras(address.getExtras());
  21. }

相关文章