I try get city according to current location with specific language i do that before like below and all work good but in my new project its not work!
Geocoder geo = new Geocoder(getApplicationContext(), new Locale("ja"));
List<Address> addresses = null;
try {
addresses = geo.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
if (addresses.size() > 0) {
Log.d("CITY",addresses.get(0).getLocality());
city.setText(addresses.get(0).getLocality());
} else {
// do your stuff
}
} catch (IOException e) {
e.printStackTrace();
}
dos not matter which language be set always name of city return with English language!
after some research i understand must set geo.getFromLocation maxResults > 1
cause always first address returned in list , return with English language but the next items will be your specific language , so just need change
addresses = geo.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
to
addresses = geo.getFromLocation(location.getLatitude(), location.getLongitude(), 2);
and getLocality like this addresses.get(1).getLocality()