更新时间: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" />