Skip to content

Tag: locale

How to create Currency instance with non ISO 3166 country like en_UK?

In my app, I get the user’s default locale using Locale.getDefault() and then pass that to Currency.getInstance(Locale). It mostly works, but I have started getting reports from users which show the following IllegalArgumentException in the stack trace: Caused by: java.lang.IllegalArgumentException: Unsupported ISO 3166 country: en_UK at java.util.Currency.getInstance( at org. I expected Android to only return valid locales, but that is