Android ஆனது main (UI) thread மீதான엄격한threading model கொண்டுள்ளது — இது UI ஐ கையாள வேண்டும் மற்றும் responsive ஆக இருக்க வேண்டும். Threading ஐ புரிந்துகொள்ளுதல், main thread இலிருந்து work ஏன் நகர்த்த வேண்டும் என்பதைப் புரிந்துகொள்ளுதல், மற்றும் tools (coroutines, மற்றும் வரலாற்று ரீதியாக threads/handlers) ஆகியவை responsive apps க்கு முக்கியமாகும்.
main thread rule
Android has a single MAIN (UI) thread that:
→ handles ALL UI operations (drawing, events) — UI updates MUST happen on it
→ must stay RESPONSIVE — blocking it freezes the UI; >5s blocked = ANR (App Not Responding)
TWO key rules:
1. DON'T do long/blocking work on the main thread (network, DB, heavy compute) → move it off
2. DON'T update UI from a background thread → switch back to the main thread for UI
