Coroutines zijn Kotlin's oplossing voor asynchrone programmering — asynchrone code schrijven (netwerkoproepen, databasebewerkingen) die sequentieel leest zonder de main thread te blokkeren. Ze zijn de moderne, aanbevolen manier om asynchrone werkzaamheden in Android af te handelen, waarbij callback-complexiteit wordt vermeden.
Waarom het belangrijk is
The MAIN (UI) thread must stay responsive — blocking it (with network/DB work) freezes
the UI (ANR "Application Not Responding" errors):
→ long operations MUST run off the main thread (asynchronously)
→ old approaches: callbacks (nested, complex), threads/AsyncTask (verbose, error-prone)
→ COROUTINES make async code clean and sequential.
