An analysis of handler and message in Android (i.)

Source: Internet
Author: User

Hander and message

1.hander



action: Accepts data from a child thread (message or Runable object) to update the bound object.
Why it appears:
There are some time-consuming actions in Android or other applications, and if they all appear in the main thread, you can't do anything else when they do. Then people think, can you apply for some "resources", Designed to handle this time-consuming operation without affecting the current process.so multithreading out, the corresponding, put some things in the other threads in the execution, at this time, we will take it as a sub-thread (we open), the system or we are using is called the main thread.
Next, when the thread operation is complete, it needs to communicate with the main thread,,,,, originally, asynchronous processing like this is complicated, but the advent of handler in Android makes the job instantly simple.
so the emergence of handler is mainly to solve the asynchronous information processing, not to be forced to say is to solve the problem of communication between the threads.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

An analysis of handler and message in Android (i.)

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.