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

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

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

Address.getFeatureName介绍

暂无

代码示例

代码示例来源:origin: square/assertj-android

public AddressAssert hasFeatureName(String name) {
 isNotNull();
 String actualName = actual.getFeatureName();
 assertThat(actualName) //
   .overridingErrorMessage("Expected feature name <%s> but was <%s>.", name, actualName) //
   .isEqualTo(name);
 return this;
}

代码示例来源:origin: com.squareup.assertj/assertj-android

public AddressAssert hasFeatureName(String name) {
 isNotNull();
 String actualName = actual.getFeatureName();
 assertThat(actualName) //
   .overridingErrorMessage("Expected feature name <%s> but was <%s>.", name, actualName) //
   .isEqualTo(name);
 return this;
}

代码示例来源:origin: zadr50/Gojek

private String AddressFromLatLng(LatLng ll) {
  Geocoder geocoder;
  List<Address> addresses;
  geocoder = new Geocoder(this, Locale.getDefault());
  String address="";
  try {
    addresses = geocoder.getFromLocation(ll.latitude, ll.longitude, 1); // Here 1 represent max location result to returned, by documents it recommended 1 to 5
    if(addresses.size()>0) {
      address = addresses.get(0).getAddressLine(0); // If any additional address line present than only, check with max available address lines by getMaxAddressLineIndex()
      String city = addresses.get(0).getLocality();
      String state = addresses.get(0).getAdminArea();
      String country = addresses.get(0).getCountryName();
      String postalCode = addresses.get(0).getPostalCode();
      String knownName = addresses.get(0).getFeatureName();
    }
  } catch (IOException e) {
    e.printStackTrace();
  }
  return address;
}

代码示例来源:origin: zadr50/Gojek

private String AddressFromLatLng(LatLng myLatLng) {
  Geocoder geocoder;
  List<Address> addresses;
  geocoder = new Geocoder(this, Locale.getDefault());
  String address="Current Location";
  try {
    addresses = geocoder.getFromLocation(myLatLng.latitude, myLatLng.longitude, 1); // Here 1 represent max location result to returned, by documents it recommended 1 to 5
    if(addresses.size()>0) {
      address = addresses.get(0).getAddressLine(0); // If any additional address line present than only, check with max available address lines by getMaxAddressLineIndex()
      String city = addresses.get(0).getLocality();
      String state = addresses.get(0).getAdminArea();
      String country = addresses.get(0).getCountryName();
      String postalCode = addresses.get(0).getPostalCode();
      String knownName = addresses.get(0).getFeatureName();
    }
  } catch (IOException e) {
    e.printStackTrace();
  }
  return address;
}

代码示例来源:origin: prabhat1707/EasyWayLocation

public static String getAddress(Context context, Double latitude, Double longitude, boolean country, boolean fullAddress) {
  String add = "";
  Geocoder geoCoder = new Geocoder(((Activity) context).getBaseContext(), Locale.getDefault());
  try {
    List<Address> addresses = geoCoder.getFromLocation(latitude, longitude, 1);
    if (addresses.size() > 0) {
      if (country) {
        add = addresses.get(0).getCountryName();
      } else if (fullAddress) {
        add = addresses.get(0).getFeatureName() + "," + addresses.get(0).getSubLocality() + "," + addresses.get(0).getSubAdminArea() + "," + addresses.get(0).getPostalCode() + "," + addresses.get(0).getCountryName();
      } else {
        add = addresses.get(0).getLocality();
      }
    }
  } catch (IOException e) {
    e.printStackTrace();
  }
  return add.replaceAll(",null", "");
}

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

featureName = address.getFeatureName();
valueText = null;
if (address.getLocality() != null) {

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

writeUTF(dos, address.getAddressLine(i));
writeUTF(dos, address.getFeatureName());
writeUTF(dos, address.getLocality());
writeUTF(dos, address.getAdminArea());

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

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());
}

相关文章