0
I have this error 'Type Mismatch' 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 solve?
Why not reuse the variable declared above that already has the answer?
editTextRespostaAviario?.text = body
– Leonardo Lima
It doesn’t work that way @Leonardolima
– user101221