One, Android thread
1. Main thread
When the application starts, the system creates a main thread, also known as the UI thread, which is primarily responsible for processing the user interface, distributing events to the appropriate user interface, and interacting with the Android UI component package. Try not to handle long-consuming operations such as network traffic, querying databases, etc. in the UI line thread, as they may block the entire process, and once the UI thread is blocked for more than a certain amount of time (currently about 5s), the user is prompted with "ANR" (the application is not responding).
The UI component of Android is not thread-safe, so the user interface is not allowed to operate from a worker thread, but only from the main thread.
As a result, the single-threaded mode of Android must adhere to the following two principles: (1) do not block the UI thread (2) do not access the Android UI component package outside the UI thread.
2. Worker threads
Android program and server-side interaction Summary