
Untitled
By: a guest on
Jun 17th, 2012 | syntax:
None | size: 0.82 KB | hits: 16 | expires: Never
How to check position with respect to lat and long
Geocoder gc = new Geocoder(this, Locale.getDefault());
try {
List<Address> addresses = gc.getFromLocation(lat, lng, 1);
StringBuilder sb = new StringBuilder();
if (addresses.size() > 0) {
Address address = addresses.get(0);
for (int i = 0; i < address.getMaxAddressLineIndex(); i++)
String addr=address.getAddressLine(i);
//use this addr string and compare . u will get the solution
}
} catch (IOException e) {}
Geocoder gc = new Geocoder(this, Locale.getDefault());
try {
List<Address> addresses = gc.getFromLocation(lat, lng, 1);
if (addresses.size() > 0) {
Address address = addresses.get(0);
String state = address.getLocality();
}
} catch (IOException e) {}