我写了这样的代码..它正确地返回城市名称,但它没有返回相应区域的邮政编码。
try
{
addresses = gcd.getFromLocation(loc.getLatitude(), loc.getLongitude(), 1);
if (addresses.size() > 0)
{
cityName=addresses.get(0).getLocality();
//areaname = addresses.get(0).getLocale();
System.out.println(cityName);
postalcode = addresses.get(0).getPostalCode();
}
}
catch (IOException e)
{
e.printStackTrace();
}
String s = longitude+"\n"+latitude +"\n\nMy Currrent City is: "+cityName +" \n and postal code of area is " +postalcode;
editLocation.setText(s);