Reputation: 3155
How can I programmatically check whether a phone has a particular locale?
Upvotes: 4
Views: 305
Reputation: 67502
You can fetch an array of Locale
s by using getAvailableLocales()
, then iterate through it to see if it's available.
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!
Upvotes: 3