I'm making an Android Java program which is taking double values from the user. If I run the program on the computer it works great because of the locale of my computer, EN_UK. But when I run it on my mobile phone with FI_FI locale, it won't work. I know the reason: In UK people use dot as decimal seperator but here in Finland the decimal seperator is comma.
DecimanFormat df = new DecimalFormat("#.#");
Double returnValue = Double.valueOf(df.format(doublenumber));
java.lang.NumberFormatException: Invalid double: "1234,5"
Use one of the other constructors of DecimalFormat:
new DecimalFormat("#.#", new DecimalFormatSymbols(Locale.US))
And then try and parse it using both separators.