java – My App Crash when i enter (2888.000. ) i want handle this error if enter dot(.) no enter dot(.) .logcat show multiple points error
having this error
”’
java.lang.NumberFormatException: multiple points
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1914)
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.lang.Double.parseDouble(Double.java:538)
”’
'app crash if i enter 288.888. i want id i enter dot after 2888.88 then app not crash '
private fun conditionalCheck(data: String, view: EditText): String {
return if (data.substringBefore(".") == "" || data.substringAfter(".") == "" ||
data.contains(",") ||
data.contains("-"))
{ view.append("")
""
}
else data
}
Read more here: Source link