【发布时间】:2019-02-11 07:12:13
【问题描述】:
我尝试根据当前位置使用特定语言获取城市,我之前像下面那样做,一切都很好,但在我的新项目中它不起作用!
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();
}
无论设置哪种语言,城市名称总是以英文返回!
【问题讨论】:
标签: android geolocation locale android-location