I have this 'Type mismatch' error in this code '$ {body.toString ()}':
fun fetchJson(){
val url = "http://localhost:8080/matematica3/naoAutomatica/get"
val request = Request.Builder().url(url).build()
val client = OkHttpClient()
client.newCall(request).enqueue(object : Callback {
override fun onFailure(call: Call?, e: IOException?) {
println("${e?.message}")
}
override fun onResponse(call: Call?, response: Response?) {
val body = response?.body()?.string()
println(body)
editTextRespostaAviario?.text = "${body.toString()}"
}
})
}
How can I resolve?