I am developing Android app in which I am taking destination in edit-text and I want latitude and longitude of that entered location.
example: I have typed in edit-text pune now I want its latitude and longitude.
From here : https://stackoverflow.com/a/3574792/2065418
Geocoder coder = new Geocoder(this);
List<Address> address;
try {
address = coder.getFromLocationName(strAddress,5);
if (address == null) {
return null;
}
Address location = address.get(0);
location.getLatitude();
location.getLongitude();
p1 = new GeoPoint((int) (location.getLatitude() * 1E6),
(int) (location.getLongitude() * 1E6));
return p1;
}
strAddress
is a string containing the address. The address
variable holds the converted addresses.