In Android to Get address from location using Geocoder
Geocoder is a class for handling geocoding and reverse geocoding.
Geocoding is the process of transforming a street address to (latitude,logitude) coordinate.
Reverse geocoding is the process of transorming (latitude,logitude) coordinate to Street address.
Here we can get address based on coordinates using Revierse geocoding
and set Address in to Textview
Geocoder geocoder = new Geocoder(this, Locale.ENGLISH);
try {
List<Address> noofaddresses = geocoder.getFromLocation(LATITUDE, LONGITUDE, 1);
if(addresses != null) {
Address retursAddress= noofaddresses.get(0);
StringBuilder strReturnedAddress = new StringBuilder("Address is:\n");
for(int i=0; i<returnedAddress.getMaxAddressLineIndex(); i++) {
strReturnedAddress.append(returnsAddress.getAddressLine(i)).append("\n");
}
myAddress.setText(strReturnedAddress.toString());
}
else{
myAddress.setText("No Address returned!");
}catch(Exception e){
}
Click here to Download Full Souce -> Find Address from latitude and longitude in Android
Geocoder is a class for handling geocoding and reverse geocoding.
Geocoding is the process of transforming a street address to (latitude,logitude) coordinate.
Reverse geocoding is the process of transorming (latitude,logitude) coordinate to Street address.
Here we can get address based on coordinates using Revierse geocoding
and set Address in to Textview
Geocoder geocoder = new Geocoder(this, Locale.ENGLISH);
try {
List<Address> noofaddresses = geocoder.getFromLocation(LATITUDE, LONGITUDE, 1);
if(addresses != null) {
Address retursAddress= noofaddresses.get(0);
StringBuilder strReturnedAddress = new StringBuilder("Address is:\n");
for(int i=0; i<returnedAddress.getMaxAddressLineIndex(); i++) {
strReturnedAddress.append(returnsAddress.getAddressLine(i)).append("\n");
}
myAddress.setText(strReturnedAddress.toString());
}
else{
myAddress.setText("No Address returned!");
}catch(Exception e){
}
Click here to Download Full Souce -> Find Address from latitude and longitude in Android
No comments:
Post a Comment