In my application, I get the default user standard using Locale.getDefault() , and then pass it to Currency.getInstance(Locale) . This basically works, but I started getting reports from users that show an IllegalArgumentException trace in the stack trace:
Called: java.lang.IllegalArgumentException: Unsupported ISO 3166 country: en_UK at java.util.Currency.getInstance (Currency.java:81) at org.
I was expecting Android to return only valid locales, but this is apparently not the case.
How do I handle such cases to make sure that I only get valid ISO 3166 locales? An easy way would be to handle this particular case, but I would prefer to use a general solution, if any.
Does anyone have any experience? Thanks.
source share