Hi I have written a code to get addresses in new york and the code as follows.
public void onLocationChanged(Location location) {
// TODO Auto-generated method stub
txtLocationView.setText("Longitudes: "
+ String.valueOf(location.getLongitude()) + "Latitudes:"
+ String.valueOf(location.getLatitude()));
Geocoder geoCoder = new Geocoder(this, Locale.ENGLISH);
try {
List<Address> addresses = geoCoder.getFromLocation(
location.getLatitude(), location.getLongitude(), 10);
String address = addresses.get(0).getAddressLine(0);
String city = addresses.get(0).getAddressLine(1);
String country = addresses.get(0).getAddressLine(2);
txtAddressView.setText("Address:" + addresses);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
But tis has returned a null Address list . um passing locaion correctly . What can possibly go wrong?