CurrencyEditText
CurrencyEditText copied to clipboard
Croatian locale doesn't use a comma, but on the bills of customers there is a comma
There must be something wrong or what?
I've tried
cetPayment.setLocale(new Locale("hr", "HR"));
What could be the problem? Or is it that you don't use decimals here? I'm getting 4.588.888.888 and instead should be getting 45.888.888,88
Hello?
Hellooooo?
Hellooooooooo?
I checked and getNumericValue function seems to have problems. You can get the value by getText instead.
Hi yigitserin. I forked your project with a new implementation in kotlin and fixed some bugs including this. https://github.com/GMCristiano/CurrencyEditText
Kotlin solution for this:
val numericValue: Double
get() {
return try {
val format = NumberFormat.getInstance(locale)
val parse = format.parse(text.toString())
parse!!.toDouble()
} catch (e: Exception) {
Double.NaN
}
}