0
Converting editable to double in Kotlin
I have edit text in my layout. I want to get double and make some calculations on it. Due to it's editable I cannot make calculations and couldn't convert it to double. Any easy way to convert it?
4 Antworten
+ 3
Artem G.
There would be !!.toDouble()
Try this:
fun main(args: Array<String>) {
var a = readLine()!!.toDouble()
var b = readLine()!!.toDouble()
println(a+b)
}
0
Why "!!.toDouble" doesn't work?
0
İt's not readln. İt,'s gettext.