Join David Gassner for an in-depth discussion in this video Using the exercise files, part of Android App Development: Google Maps.
- This course is accompanied by exercise files that you can use to follow along with the demonstrations on screen. I've copied the exercise files to my desktop but you can place them anywhere on your hard disk. The exercise files are organized by chapter, with one folder for each chapter in the course. Within the chapter folders you'll find one folder for each video and then within those, sub folders that are designed as Android Studio projects. These projects have been paired down to be portable so you should be able to open them on either Windows or on MAC.
You can tell its Android Studio project by the inclusion of an .iml file, a configuration file, and by the presence of a number of other files and folders that are common to Android Studio. On Windows you'll see a folder named .idea. That folder exists on MAC also but it might not be visible in finder. You won't need to deal with that folder at all because it just contains configuration information that's managed by Android Studio. In order to open any of these projects go to the Android Studio welcome screen.
Choose Open an existing Android Studio project and then navigate to your exercise files folder. If you've placed them on the desktop like I did, you can just type Desktop, and the cursor will go to that folder. Then from there you can open the Exercise Files, go to the chapter folder, to the video folder, and then select the project folder. Which is identified by an Android Studio icon. Click Ok, and that should open the project.
The first time you open any particular project it might take up to a minute to build the project but after that you should be able to make changes and relaunch the project in just a few seconds. You can look at the project's files by choosing the Project window. By default it should open up in the Android view but if you see it's in the project view you can easily switch back if necesary. The project view shows all of your files and folders exactly as they're actually represented on disk.
While the Android view pairs down the view and reorganizes it a bit so you can find your Android Manifest file here, your Java classes here, and your resources here. Your Gradle Scripts are organized together under this virtual folder and you'll see that there are two build.gradle files. One for the project itself and one for the App module. That's the file where you would configure your sdk version and set any dependencies for Android or Java libraries that you want to incorporate into your App.
In addition to the core exercise files, there's an assets folder that contains two image folders. One contains a series of photo files. Now I won't actually be accessing these files during the course but I've built versions of these into some of the sample Apps and I'm providing these files for convenience. The Launcher icons folder contains two graphics that are used as launcher icons in the course and then finally there's an API key.txt file.
You can open this file in any text editor, I'll open it in notepad. If you open this file on your system you'll only see the text "My API Key". I'll show you how to get an API key for use with Google Maps early in the course and then show you how to copy it to this file, and here's why you're going to need it. You need an API key to use Google Maps in any Android App and my API key can only be used on my computer. So you'll need to go get your own API key and copy it into every single project.
I'll copy the API key to the clipboard. And then I'll go back to Android Studio. Then I'll open my Android Manifest file and scroll down toward the bottom. I'll locate the metadata tag for the API key and then I'll double-click to select the string, "Your API Key", and I'll paste my key into place. Now again, you'll need to do this for every project for which you are going to display a Google Map. It's a minor inconvenience but one that's made necessary by the rules of using API keys and Google Play services.
There's one more folder that I'll point you to and that's the Solutions folder. This folder contains copies of all of the exercise files in their finished states. They're also set up as Android Studio projects so you can easily open them to see what the finished code looks like.
- Getting a Google Maps API key
- Adding the Google Play services library
- Setting a map's initial state
- Geocoding addresses
- Displaying different types of maps
- Working with the current location
- Adding and customizing map markers
- Drawing on maps
- Preparing map apps for deployment