MΓ³dulo 03 Β· Kotlin for Real Apps: Serialization & Coroutines β LecciΓ³n 4 de 4 Β· ~12 min
Coroutines: Waiting Without Freezing
The main thread
Everything your user sees runs on one lane of execution called the main thread. It redraws the screen dozens of times a second, and it handles every tap, scroll, and animation. It's fast β as long as nobody makes it wait.
A network request to the PawWalk backend takes anywhere from 50 milliseconds to several seconds on hotel Wi-Fi. If the main thread stood still waiting for that response, the app would freeze: scrolling dies mid-flick, buttons ignore taps, spinners stop spinning. Users experience it as "the app is broken" β and Android will eventually show an Application Not Responding dialog and offer to kill it.
So the rule is: the main thread may start slow work, but it must never stand around waiting for it.