The principle of UI thread from the perspective of Android Handler/Looper

Overview The Handler/Looper mechanism is a non-important and basic mechanism of the Android system. This mechanism is often used for reference even when developing application frameworks on rtos or linux operating systems. Through this mechanism, a thread can process events in a loop, and the event processing logic is in the Handler’s handleMessage. This article […]

Android Native Looper Mechanism

This article is excerpted from Android Framework Tutorial for Application Development. For the complete tutorial, please visit https://yuandaimaahao.github.io/AndroidFrameworkTutorialPages/. For more detailed video tutorials and Q&A services, please contact WeChat zzh0838 This article is based on the aosp android-12.0.0_r26 branch. After a simple main function is executed, the entire process ends. In order to allow a […]

Android Looper and Handler

Message: Message, which includes message ID, message processing object and processed data, etc., is uniformly queued by MessageQueue, and finally processed by Handler. Handler: Processor, responsible for sending and processing messages. When using Handler, you need to implement the handleMessage(Message msg) method to process a specific Message, such as updating the UI, etc. MessageQueue: Message […]

Android system principle problem analysis – analysis of message passing mechanism (Looper and Handler)

Statement In the Android system, we often encounter some system principle problems, which will be discussed in this column. For example: Android is not allowed to operate the UI outside the UI thread for thread safety. In many cases, it is necessary to notify the UI component update through the Handler to refresh the interface. […]

Android — Looper.prepare() and Looper.loop()

Looper.prepare() and Looper.loop() The Looper class in Android is a class used to encapsulate message loops and message queues for message processing in android threads. Handler can actually be regarded as a tool class. Used to insert messages into the message queue. (1) The Looper class is used to open a message loop for a […]

Android Stability: A Remotely Configurable Looper Pocket Framework

Author: Zou Atao Taotao Taotao App Crash is the worst experience for users. It will lead to process interruption, poor app reputation, app uninstallation, user loss, order loss, etc. Relevant data shows that when the crash rate of Android App exceeds 0.4%, the number of active users decreases significantly. At present, benefiting from a series […]