I am used this code for get all details from Geo coding :

Geocoder gcd = new Geocoder(this, Locale.getDefault());
// 37.775,-122.19
List<Address> addresses = gcd.getFromLocation(currentLatitude,
currentLongitude, 100);

if (addresses.size() > 0) {
StringBuilder result = new StringBuilder();
for (int i = 0; i < addresses.size(); i++) {
Address address = addresses.get(i);
int maxIndex = address.getMaxAddressLineIndex();
for (int x = 0; x <= maxIndex; x++) {
result.append(address.getAddressLine(x));
result.append(",");
if (address.getLocality() != null) {
city = address.getAdminArea();

}
}

if (address.getPostalCode() != null) {

zipcode = address.getPostalCode();
} else if (address.getCountryName() != null) {
country = address.getCountryName();

} else {

}

result.append(address.getLocality());

result.append(",");
result.append(address.getPostalCode());

result.append("\n\n");
}

On Wed, Oct 20, 2010 at 1:31 PM, James Elsey <[email protected]> wrote:

> You could try to use the Yahoo APIs for geocoding
>
> I wrote a quick tutorial here :
>
> http://www.jameselsey.co.uk/blogs/techblog/tutorial-how-to-call-yahoo-rest-web-services-the-easy-way/
>
> On Oct 19, 10:36 pm, Tommy <[email protected]> wrote:
> > Hi everyone,
> >
> > I am using the Geocoder.getFromLocation(lat,lon,1) and it seems that a
> > lot of the time nothing gets returned to the List<Address> array
> > sometimes it works as it is suppose to. Is there a better way to get
> > the city/state from the lat/lon that is more reliable? the code I use
> > is below:
> >
> > Geocoder gc = new Geocoder(this, Locale.getDefault());
> >                         List<Address> addresses = null;
> >
> >                                         addresses =
> gc.getFromLocation(lat, lon, 10);
> >                                         cityState =
> addresses.get(0).getLocality();
> >                                         stateAbrv =
> addresses.get(0).getAdminArea();
> >
> > When it doesn't work it is because addresses  is null
> >
> > Thanks in advance for the help,tips, and/or advice,
> >
> > Tommy
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to