The Android Main Thread
A thread is a pipeline that handles a sequence of work to be performed. The main thread of an Android application is reserved for processing the work required for keeping the UI responsive: handling button presses, rendering updates when the user scrolls, and updating the text box as characters are generated, for example. For this reason, it is sometimes called the “UI thread.”
When you requested data from the web API, the UI would have been unresponsive while that request completed. This is called “blocking a thread”, because the thread cannot move forward to the next work to process until the current – possibly long-running – work completes. Android explicitly forbids networking on the main thread because it ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access