0

i wrote code like this.. Its returning city name properly but its not returning postal code of respective area.

 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);
Ankit Kumar
  • 3,663
  • 2
  • 26
  • 38
  • similar to [this one](http://stackoverflow.com/questions/8442050/how-to-get-zip-code-or-area-code-of-the-current-location-in-android)....please see if it solves the problem... – Yogesh D Mar 19 '14 at 10:42
  • It returns `null` ? Maybe the postal code is unknown ? Did you try with several differents addresses ? – JGeo Mar 19 '14 at 10:43
  • I tried it for Bangalore.. and I think its good enough example of test case.. the latitude, longitude and city name are returned by it.. only postal is the problem for me. – Ankit Kumar Mar 19 '14 at 10:46

0 Answers0