Coroutines Kotlin ਦਾ asynchronous programming ਦੇ ਲਈ ਹੱਲ ਹਨ — async ਕੋਡ (network calls, database operations) ਲਿਖਣਾ ਜੋ main thread ਨੂੰ block ਕੀਏ ਬਿਨਾਂ ਕ੍ਰਮਵਾਰ ਪੜ੍ਹਿਆ ਜਾਂਦਾ ਹੈ। ਇਹ Android ਵਿੱਚ async ਕਾਰਜ ਸੰਭਾਲਣ ਦਾ ਆਧੁਨਿਕ, ਸਿਫਾਰਸ਼ ਕੀਤਾ ਤਰੀਕਾ ਹੈ, callback ਜਟਿਲਤਾ ਤੋਂ ਬਚਦਾ ਹੈ।
Android ਵਿੱਚ async ਕਿਉਂ ਮਾਇਨੇ ਰੱਖਦਾ ਹੈ
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.
