如何从Android的地理codeR获得独立于语言的值 [英] How to obtain language independent values from Android Geocoder

查看:179
本文介绍了如何从Android的地理codeR获得独立于语言的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个应用程序,我需要知道用户的位置:国家,州/省,城市/乡村。然后,我希望用户在基于他们的位置某种方式进行交互:国家,州/省或城市/乡村。然而,地缘codeR给我在电话设置为语言这些位置。出于这个原因,我不能准确地比较与那些在同一个国家的其他用户,州/省或城市/城镇字符串,如果他们的语言设置不同。

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 locations 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解决方案是使用全国codeS。但州/省或城市/城镇仍然是一个问题。有什么建议?

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).

请参阅 http://developer.android.com/reference /android/location/Geo$c$cr.html

如果所有客户端使用相同的语言环境参数,那么都应该收到相同的请求同样的反应。

If all clients use the same locale argument, then all should receive the same response for the same requests.

这篇关于如何从Android的地理codeR获得独立于语言的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆