getpostalcode()没有返回邮政编码

时间:2014-03-19 10:37:58

标签: java android android-layout geolocation

我写了这样的代码..它正确地返回城市名称,但它没有返回相应区域的邮政编码。

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

0 个答案:

没有答案