Coroutines huma s-soluzzjoni ta' Kotlin għal asynchronous programming — ikteb code async (network calls, database operations) li jleq sekwenzjalment mingħajr li jiblokkja l-main thread. Huma l-mod modern, rakkomandat biex tiddaħħal async work fl-Android, u tevita l-kompleksità tal-callbacks.
Għaliex async huwa importanti fl-Android
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.
