gpt4 book ai didi

android - 有没有一种简单的方法来检索 ISO 3166-1 数字国家代码

转载 作者:行者123 更新时间:2023-11-30 03:27:32 32 4
gpt4 key购买 nike

我想知道我是否可以在 ISO_3166-1 numeric 中获取 sim 国家代码android 中的样式。

我可以获得 2 个字母的国家 ISO,如下所示:

TelephonyManager manager = (TelephonyManager)getSystemService(this.TELEPHONY_SERVICE);

String ISO2=manager.getSimCountryIso();

最佳答案

试试这段代码,

TelephonyManager manager = (TelephonyManager)getActivity().getSystemService(getActivity().TELEPHONY_SERVICE);
String ISO2 = manager.getSimCountryIso();
String ISO3 = new Locale("", ISO2).getISO3Country();

关于android - 有没有一种简单的方法来检索 ISO 3166-1 数字国家代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18006482/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com