Android developers need to understand the nature of a thread, and what it means when an application is running more than one thread at a time. On any sort of computer, whether it be a desktop, a laptop, a tablet, or a cell phone, while one instruction is being executed, the CPU can’t do anything else. On modern computing devices, these tasks can be incredibly fast, but there’s still only one thing happening. The CPU just can’t do two things at the same time.
- [Instructor] Android developers need…to understand the nature of a thread…and what it means when an application is running…more than one thread at a time.…On any sort of computer,…whether it be a desktop, a laptop, a tablet,…or a cell phone, a CPU executes a sequence…of instructions.…While one instruction is being executed,…the CPU can't do anything else.…Each instruction takes as much time as it needs…and then the CPU goes on to the next instruction.…On modern computing devices,…these tasks can be incredibly fast,…but there's still only one thing happening.…
The CPU can't do two things at the same time.…When you execute multiple simultaneous operations,…that's called multithreading.…Contemporary Android devices have multiple CPUs,…also sometimes known as cores.…The operating system is able to assign multiple threads…to the different cores as needed…and that's how it accomplishes running…multiple threads simultaneously.…On an Android device, the user interface,…what the user sees,…runs on a single foreground thread,…
First, discover how to create and start simple background threads, and how to use handlers to manage a thread's message queue. Then, learn various methods for optimizing the scheduling and performance of background tasks in Android with AsyncTask, intent services, and the JobScheduler API. Plus, explore tools that help you implement multithreading for different tasks in Android: Loader, for asynchronous data loading, and the open-source API Retrofit, for making HTTP requests.
Note: To get the most out of this course, you should be comfortable programming with Java, and should understand the most basic skills that are needed to build Android apps with the Android SDK and Android Studio.
- Creating and running a background thread
- Sending messages to the UI from threads
- Managing multiple background threads
- Managing threads with AsyncTask
- Managing long-running tasks with services
- Scheduling background tasks with JobScheduler
- Using other APIs for concurrent programming