I am quite new to Android app development and would like to perform a simple API request via HTTP to a web server. URL("http://www.myapi.com").readText()
seems to be a good way to start with, but this leads to a NetworkOnMainThreadException
. So it must run asynchronously or in a coroutine. However, I'm not familiar enough with this and other examples I have found so far don't work for me.
Thanks a lot already for your help!