How to obtain language independent values from Android Geocoder
I am working on an application where i need to know the users location: country, state/province, and city/town. Then I want users to interact in some way based on their location: country, state/province, or city/town. However the geocoder gives me these loca开发者_StackOverflow社区tions in the language that the phone is set to. For that reason I can't accurately compare strings with other users that are in the same country, state/province, or city/town, if their language is set differently.
1 solution for countries is using the country codes. But states/provinces, or cities/towns are still a problem. Any suggestions?
Use the constructor that accepts a Locale argument rather than the default (which uses the system locale).
See http://developer.android.com/reference/android/location/Geocoder.html
If all clients use the same locale argument, then all should receive the same response for the same requests.
精彩评论