my below code doesn't give any result.
list_addr = gc.getFromLocation(latitude, longitude, 5);
even not returns null
value...
it behaves like dumb.
give me solution for that.
my below code doesn't give any result.
list_addr = gc.getFromLocation(latitude, longitude, 5);
even not returns null
value...
it behaves like dumb.
give me solution for that.
Geocoder.getFromLocations(double, double, int)
either returns a result (even null is a result) or throws an exception.
Are you silently catching generic exceptions somewhere in your code?
Update:
Use this code and then check the logcat. It should give you a reason why this does not work:
Geocoder gc = new Geocoder(getApplicationContext(), Locale.getDefault());
try {
List<Address> list_addr = gc.getFromLocation(40.0d, 10.0d, 5);
} catch (IllegalArgumentException iae) {
Log.e("Geocoder IllegalArgumentException exception: ", iae.getMessage());
} catch (IOException ioe) {
Log.e("Geocoder IOException exception: ", ioe.getMessage());
}
Update2:
This turned out to be a bug in Emulator v2.2: Android; Geocoder, why do I get "the service is not available"?
try this
List<Address> addresses = new Geocoder(MyActivity.this,Locale.getDefault()).getFromLocation(latitude, longitude, 1);