Android Handler, Lopper message-driven mechanism

Source: Internet
Author: User

Android applications are driven by messages , and the system maintains a message team example (Mesagequeue)for each application, and the main thread of the application constantly gets messages from this message team example (Mesage), These messages are then processed (Handler), which enables the execution of the application to be driven by messages.

When Activitymanagerservice needs to interact with the app, such as loading activity and service, processing the broadcast, the application is notified through the binder interprocess communication mechanism, and the application receives the request , it does not immediately process the request, but encapsulates the request as a message, then puts the message in the application's message queue and then processes the message through the message loop. The advantage of this is that the sender of the message simply sends the message to the application's message queue, and it can go back to handling something else immediately, without waiting for the message receiver to process the message before returning , which can improve the concurrency of the system. Essentially, this is an asynchronous processing mechanism.

Android Handler, Lopper message-driven mechanism

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.