I'm using Geocoder
in reverse way to get an address from a given lat & lon.
Do you know how to get from Address
only the street name?
Geocoder geocoder = new Geocoder(AutoFinderMapActivity.this);
try {
List<Address> addressList = geocoder.getFromLocation(latitude, longitude, 1);
if (addressList != null && addressList.size() > 0) {
// Help here to get only the street name
String adress = addressList.get(0).get...;
}
} catch (IOException e) {
e.printStackTrace();
}
Thanks in advance,
I was searching up the very same thing. I disagree with the answer that was marked as correct. I could be wrong but it would appear that "Thoroughfare" (what a quaint old English term!) is the field that provides the street name. so for example:
get the addresses:
List<Address> addresses = null;
addresses = geocoder.getFromLocation(latitude, longitude,1);
if(addresses != null && addresses.size() > 0 ){
Address address = addresses.get(0);
// Thoroughfare seems to be the street name without numbers
String street = address.getThoroughfare();
}