Summary
In this chapter, we've taken a detailed look at AsyncTask
and how to use it to write responsive applications that perform operations without blocking the main thread.
We saw how to keep the user informed of the progress, and even allow them to cancel operations early. We also learned how to deal with issues that can arise when the Activity
lifecycle conspires against our background tasks.
Finally, we considered when to use AsyncTask
, and when it might not be appropriate.
In the next chapter, we'll take a look at some lower-level constructs—fundamental building blocks on which the other concurrency mechanisms of the platform, including AsyncTask
, are built.