The way that Android implements Locales (from my understanding and readings) will leave your apps mis-behaving and acting oddly for users if you need to access cross-region features in your app while in another country.
A Real World Locale Problem
Imagine the scenario where your sell products pertinent to a location, like daily deals (think of any daily deals app).
Assume you’re currently in the USA and you have a family member living in Germany. You decide to open the deal application and view the deals in Germany because you want to purchase a deal for that family member. If you’re looking at a deal in Germany you should see the deal price information (and date/etc) in the German context, as this is where you’re buying it (yes, this is up for argument, but assume this is how the APP HAS to show it).
These deals SHOULD show you the deal information in Euro’s and the date formatting should be as you’d see it in Germany.
Unfortunately this is not the case with Android. It MAY or MAY NOT be formatted correctly. With Android you cannot guarantee correct formatting when using the DateFormat and Currency objects as you’d normally do in Java.
Its pretty simple actually (and makes sense, but it does suck) …
Android (as with other mobile OS’s) is an operating system that runs on embedded devices. Android’s runs on as many different mobile devices created by numerous different manufacturers. Due to size constraints, only certain Locales are loaded on the device. For example, a friend of mine has an incredible 2 device which has 17 languages (basically multiple Locales) while one of my test devices (Samsung Vibrant) has only 2. The Nexus S has been reported to have 39 Languages (many many locales). The larger, newer devices have more locales.
So what happens when your device does not have a locale and you request it with code like this?
Currency.getInstance( “BRL” ); // Brazilian Real (the currency for brazil)
When you format items with this currency object the result is not what you expect. Depending on the device, the currency symbols are in the wrong location and sometimes certain currency symbols are incorrect altogether (i guess that would be gracefully degrading, not sure what to call it).
At this time I don’t have a great solution. I really hope someone (either a Googler, or another Android dev) will come along and point out that I’m wrong (but I’m fairly certain there is a problem with this somewhere). The only solution that I have at this point is to implement formatters for the known locales that my app will be dealing with. This means creating my own DateTime formatter, currency formatter and other formatters. While not a HUGE pain in the butt (Java’s not that hard … ) its still a nuisance because its not well documented anywhere that I can find.