且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何按英国的经度和纬度查找邮政编码

更新时间:2022-04-03 22:41:21

如果您正在谈论邮递区号,请使用它..

If you are talking about PostalCode then, use this..

Geocoder geoCoder = new Geocoder(getApplicationContext(), Locale.getDefault());
List<Address> address = null;

if (geoCoder != null){
   try {
       address= geoCoder.getFromLocation(latPoint, lngPoint, 1);
       } catch (IOException e1) {
       // TODO Auto-generated catch block
       e1.printStackTrace();
      }
      if (address.size()> 0){
        String postCode = address.get(0).getPostalCode();
      }

具有清单文件的这两个权限.

With these two permission on Manifest file..

<uses-permission android:name="android.permission.INTERNET" /> 
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />