如何以编程方式检查手机是否具有特定区域设置?
答案 0 :(得分:3)
您可以使用getAvailableLocales()
获取Locale
的数组,然后遍历它以查看它是否可用。
boolean hasLocale = false;
String myLocale = "en";
Locale[] locales = Locale.getAvailableLocales();
for (Locale locale : locales) {
if (locale.getLanguage().equals(myLocale)) {
hasLocale = true;
}
}
// Value of `hasLocale` is what you want here!