Why Geocoder from Google Maps is returning japanese character?

前端 未结 2 1661
轻奢々
轻奢々 2021-01-14 11:22

I have a method with body like this:

Address address = new Geocoder(context).getFromLocation(latitude, longitude, 5).get(0);
return address.getThoroughfare()         


        
2条回答
  •  清歌不尽
    2021-01-14 11:28

    The constructor of the Geocoder class takes a Locale Object as parameter. With this you can have the output in any supported language. If you don't set a explicit local, as in your snippet, Locale.getDefault() will be used by default.

    Address address = new Geocoder(context, Locale.ENGLISH)
            .getFromLocation(latitude, longitude, 5).get(0);
    

提交回复
热议问题