I am using android geocoder.getFromLocation(nLatitude, nLongitude, 1) to
get address from lat/long, my code is:
String address = addresses.get(0).getAddressLine(0);String address1 =
addresses.get(0).getAddressLine(1);String city =
addresses.get(0).getLocality();String subcity =
addresses.get(0).getSubLocality();String province =
addresses.get(0).getAdminArea();String subprovince =
addresses.get(0).getSubAdminArea();String country =
addresses.get(0).getCountryName();String postalCode =
addresses.get(0).getPostalCode();String knownName =
addresses.get(0).getFeatureName();String premises =
addresses.get(0).getPremises();
Here I am getting duplicate words like city, subcity, premises all have
city name or sector i.e. two/three time city name. Sometimes it is not
showing sector name so I used addresses.get(0).getAddressLine(1) to get it.
But somewhere its right.
At last I used this:
String tostring = addresses.get(0).toString();String[] ar =
tostring.split("\"");String add1 = ar[0];String add2 = ar[1];String add3 =
ar[2];String add4 = ar[3];String add5 = ar[4];String add6 = ar[5];String add7 =
ar[6];
For complete address I use only add2, add4 and add6 on splitting at ".
But again I am getting somewhere add2 and add4 both have city name like
01, Navi Mumbai, Sector 35, ......, Navi Mumbai, Maharashtra
Navi Mumbai is two times.
Please provide help.
--
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-developers/a6972fb8-63af-420f-a033-0d95d9b9e9f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.