Common Message Processing APIs

Source: Internet
Author: User

interview: Child threads must not be able to update the UI? Surfaceview: Multimedia video playback, you can update the UI in a child thread, Progress related controls: You can also update the UI in a child thread; audit mechanism: When the activity is fully displayed, the audit mechanism detects that the child thread has not updated the UI.
        

1. Update the UI using the activity's Runonuithread method, which will be executed on the main thread, regardless of whether or not the current threads are main thread.
Runonuithread (New Runnable () {
                    
@Override
Public void Run () {
Tv_simple.settext ("I have been updated");
                    }
                });

2. Using the handler direct post to the main thread, handler needs to be created in the main thread
//Delay how many millimeters to perform runnable.
mhandler.postdelayed (New Runnable () {
                    
@Override
Public void Run () {

Tv_simple.settext ("I have been updated");
                    }
}, 1000*5);

Application Scenario: After the ad shows, do the page jump.

Common message Processing APIs

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.