Whenever this code is executed, the app crashes and no data is returned.
I have already tried Volley
and okhttp
and neither worked.
val url = "https://..."
val lines = URL(url).openStream().use {
it.bufferedReader().readLines()
}
outputText.text = lines.toString()
I expect to see the returned information but instead the app crashes.