Input var into label.text

Hello Im new here, also Im new in development.

I try to make an app but i got an issue i can’t pass. I searched a long time but i didn’t find anything. Even if its a simple problem.

I made an Var:

private var highscore: Int = 0

and a function

fun score() {

    highscore ++
    scorelbl.setText(highscore)
}

i think it doesn’t work because there is type issue but i can’t fix it.

Thanks for your time.

highscore is an Int, but setText expects a string. Use highscore.toString() to convert it to a string.

1 Like

@FG I’d also suggest that you check out Google’s Kotlin Android Development course on Udacity :face_with_monocle:

1 Like

thanks a lot

1 Like