From the course: Android Development Tips

Download exercise projects from GitHub - Android Tutorial

From the course: Android Development Tips

Download exercise projects from GitHub

- [Instructor] The exercise files for this weekly series of tips for Android developers is stored on GitHub as a single repository with multiple branches. You'll find the repository at github.com/davidgassner/weeklytips. There are a couple of different ways of working with this repository. The simplest approach doesn't require signing into GitHub or any use of GitHub within Android Studio. Go to the repository at this URL. Then pull down the list of available branches. You'll find two branches for each exercise. For example, Tip001 is the beginning state of the first tip and Tip001-Done is the completed state. Let's say I wanted to work through the exercise from the beginning. I would select the beginning state for that exercise. Notice how the URL changes. It ends now with tree/ and then the tip number. Now I'll click Clone or download and choose Download Zip. The zip file is downloaded to your system. I'll open it up, and then I'll extract its contents. You can extract the contents anywhere you like. For convenience, I'll extract the contents to my desktop. On Windows, I can do that by clicking into the zip file and then dragging the top level folder to the Desktop folder. And that will extract the contents and I can now open that as an Android Studio project. I'll go to Android Studio to the welcome screen. I'll select Open an existing Android Studio project. I'll go to my Desktop directory, which I can do with Control + D on Windows or Command + D on Mac. And I see the Android Studio icon displayed in the folder. I'll select it and click OK, and that opens up the project. If you see this dialog asking you to update your Gradle plugin, always click Update. And similarly, if you see any other prompts to update various components of your SDK, accept those as well. You might see this Error Loading Project dialog appear down in the lower right corner. Just be patient. It should go away fairly quickly. And to make sure that everything's working okay, go to the Project window and make sure that you can see an App module. Once the Gradle build process is done, and you'll know that by watching the bottom status bar, you'll be ready to run the app on a device. For most of the tips in this first collection, I'm using a virtual device, but you can use a virtual or a physical device. There are some exercises that need a physical device for testing, but I'll tell you about that in those exercises. I'll select my virtual device, which I already have running, and after a moment, the application appears. This first exercise describes how to switch from Toast messages to Snackbar messages. And in the beginning state when I click Run Code, I'm not seeing any messages at all. Now, I'll go back to GitHub and I'll download the completed version of the project, Tip001-Done. And once again, I'll download the zip file. I'll open the zip file and extract its contents to the desktop. And now the desktop has two folders, one for the beginning state and one for the ending state. I'll go back to Android Studio, and I'll select Open. I'll navigate to my Desktop, and this time I'll choose the completed state. I'll click OK and then when I'm prompted, I can select New Window, so I can have two projects open at the same time. Once again, I'll update the Gradle plugin, and I'll wait until the Gradle build process is completed. Then I'll run the app on my device again. And now when I click the Run Code button, I get a Snackbar message. And when I click the button on the Snackbar message, I get a Toast message. And I'll be showing you how to do all that in the very first tip. And because I now have both projects open at the same time, I can easily switch between them by simply going to the Window menu and selecting the project I want to look at. So that's working with GitHub without signing into it and without depending on GitHub integration in Android Studio. If however, you're accustomed to working with GitHub or you want to get used to using it in Android Studio, you can use that technique. And I'll show you how to do that in the next video.

Contents