Android three-asynctask

Source: Internet
Author: User

Basic Introduction: http://blog.csdn.net/liuhe688/article/details/6532519

Extended Knowledge: http://blog.csdn.net/pipisky2006/article/details/8535454

http://blog.csdn.net/hitlion2008/article/details/7983449

Lightweight threading

Precautions:

1. Create a new class in the UI thread that implements the Asynctask<params,progress,result> interface

2. Invoke execute (params...params) execution in the UI thread, OnCancel (), Cancel execution

3, OnPreExecute (), OnPostExecute (Result,res), Onprogressupate (progress...values), oncanceles ()---the above methods can change the UI

Doinbackground (params...params)----used to perform time-consuming tasks and not update the UI, where Publishprogress (Progress val) is called to update progress

All of the above methods are automatically called execution, only need to rewrite to

4. One task can only be executed once

5, a Asynctask life cycle, contains the following states:

Pending,running,finished

Is an enumeration saved, using the GetStatus () method to get

Android three-asynctask

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.