APPENDIX D: The AsyncTask Class

Chapter opener image: © Fon_nongkran/Shutterstock

A Thread is a sequence of code that executes inside an existing process. The existing process is often called the Main Thread. For an Android app, it is also called the User Interface Thread. There can be several threads executing inside the same process, and threads can share resources, such as memory.

When we start the app, our code executes in the main thread. Sometimes, we need to start another thread. For example, we may need to retrieve data from a remote location. Furthermore, we may need that other thread to finish before we use and place its data ...

Get Android App Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.