The exercise files for this course are available through a GitHub repository. Learn where to get the repo, and two different ways to use it—either with Git through Android Studio, or by downloading each branch as you need it to follow along with particular videos. The repo includes two branches for each video—one for the exercise's starting state, and one for the completed state.
- [Instructor] This course is accompanied by exercise files that you can use to follow along with the demonstrations on screen. The exercise files are stored as a Github repository on Github.com at the URL shown here. In order to download the files to your system, there are a couple of different ways to use the exercise files. If you already have Git installed on your system and it's integrated into Android Studio, you can simply clone the repository. Go to the repository on Github then click the clone or download button and click this button to copy the URL to the clipboard.
Then go to Android Studio's welcome screen. Click check out project conversion control, and choose Github. If you're prompted for any credentials, enter them and then you should be able to paste that URL into place. The default location where you will be downloading the Github repository is under Android concurrency, under your Android Studio projects directory, but you can change that location if you like. Click the clone button, and then when prompted, click yes to open the new repository.
The master branch for this repository is a simple application and I'll show you how to use the application during the earliest part of the course. When you first open the repository, you might see some prompts. If you're prompted to upgrade your grade or plugin, say yes. If you see this message asking if you want to add a file to Git, you can say no. That's not necessary. If you see a prompt indicating that you need a particular version of the Android build tools, follow the instructions to download that package. You'll then be able to use that version of the build tools throughout the rest of the course.
From this point forward, you'll be working in a Github repository with multiple branches. In the project window I'll show the beginning file, named main activity in the concurrency package. To switch to a new branch, go to the menu and choose VCS, Git, Branches, and then choose the appropriate branch. You'll see one starting branch and one complete branch for each of the exercises. So for example, if I were in chapter two, video number one, I would choose origin 201 and then choose checkout as local branch.
And then click OK to download that branch. And you'll probably see some changes occur in the files. If you want to see the completed version of any branch, go through that process again, choose the version that you want and check it out, and then you'll see the completed code. If you don't have Git installed on your computer and you don't want to install it, you can use the exercise files in a different way. On Github, click the branch button and then scroll to the branch you're interested in.
Once again, for example, I'll go to Chapter Two, video number one. Then click clone or download, and choose download zip and you'll get a zip file containing the project in that state. I'll open the zip file and then I'll drag this file over to my desktop. I'll close this project and then I'll select open an existing Android Studio project. I'll navigate to my desktop, I'll choose the project, click OK and now I'm opening just that one version of the project.
When you download a zip file and you open a project in this way, you won't have immediate access to all the other branches. You can only get that if you have Git installed on your computer. But either way, you'll be able to work through the entire project and work with all the different branches for the different exercises. This course was built with Android Studio 2.3.3 and you'll need at least that version to follow along. If you're working in Android Studio 3, the preview edition, or any other later version, the project should update as you open it.
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