【发布时间】:2017-12-02 21:55:37
【问题描述】:
我是 Java Android 新手。
我想使用Locale(参考ISO 3166-1 numeric)中的国家/地区代码获取国家/地区名称(字符串)
试图做类似的事情(其中 [...].getCountry() 返回 int 826):
Locale countryName = new Locale("", String.valueOf(profile.getPersonnalInformation().getAddress().getCountry()));
并使用以下命令获取国家/地区名称:countryName.getDisplayCountry()
它通常应该返回“United Kingdom”,但不幸的是我有 826。
我该怎么做?
提前感谢您的帮助,
【问题讨论】:
-
@MehdiKhademloo 谢谢你,但我尝试用 int 数字而不是你的例子中的字符串来做。我已经尝试将我的 int 转换为 String 并使用它,但它不起作用,所以你的链接对我没有帮助。在您发布之前我已经阅读了它。
-
这很重要,因为当您读取手机中的联系人时,您会得到一个数字(2 位),但当您使用 libphonenumber 时,您会输入一个 alpha-2..
标签: android locale country-codes