Exactly which thread the Android post () method is running on

Source: Internet
Author: User

There are two General post () methods that are commonly used in Android:

1. If the Post method is handler, the runnable executes in the handler dependency thread, either the main thread or another thread 2. If the Post method is view, it must be running in the main thread, because all the view comes with a handler, all handler have a POST method, so its runnable is run in the main thread

For example: ImageView comes with a handler, it has postdelayed method, because ImageView is on the main thread, so runable is the code that runs in the main thread.

imageview.postDelayed(new Runnable() {          @Override          public void run() { Intent mIntent = new Intent(MainActivity.this, SecondActivity.class); startActivity(mIntent); finish(); } }, 2000); 

Exactly which thread the Android post () method is running on

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.