while testing the app that I'm working on right now I stepped into weird problem, my app works fine on emulator but crashes on my device(huawei p9, I don't know if it really matters). It seems like this two particular lines of code are reason of crash(app works fine on device after removing this formatting code):
val formatedBruttoPrice = "%.2f".format(price).toDouble() // price is a double
val formated = "%.2f".format(totalPrice).toDouble() // totalPrice is also a double
The error that I get java.lang.NumberFormatException: For input string: "2,0"
Any ideas why? And how to fix this?
question from:https://stackoverflow.com/questions/66059334/why-format-crashes-an-app-only-on-device