Home » Android » geolocation – Android GeoCoder returns only 1 result

geolocation – Android GeoCoder returns only 1 result

Posted by: admin June 15, 2020 Leave a comment

Questions:

In my Android application, the user can enter an address to set up his location. For that, I’m using Geocoder and the getFromLocationName method.

Everything works fine when I’m looking for basic cities but as soon as I look for ambiguous location, such as Villefranche in France (there are more than 10 cities called Villefranche in France), GeoCoder returns only 1 result.

Here is how I call the method:

resultReverseGeo = geoCoder.getFromLocationName(name, 5);
Log.d(TAG, "Size " + resultReverseGeo.size()); // size is always = 1 

Any idea?

How to&Answers: