Join David Gassner for an in-depth discussion in this video Using the exercise files, part of Android SDK: Local Data Storage.
This video series includes exercise files that you can use to follow along the demonstrations that I do onscreen. I've copied the exercise files to my desktop, but you can place them anywhere on your hard disk. The Exercise Files folder has five folders for each of the five chapters in the course, plus two folders named Assets and Solutions. The chapter folders contain subfolders that are set up as Eclipse project. You can import these into the version of Eclipse that's included with the Android Developer Tools.
For example, I'll go to the Android Developer Tools bundle. This is the bundle for Jelly Bean Android 4.2, and that's the version you'll need to work along with the course. From the bundle folder, I'll go to Eclipse and then open the Eclipse application. To import one of the projects, I'll select File > Import. Then I'll select Existing Project into Workspace from the General category. I'll browse, I'll go to my Exercise Files folder, then I'll go to the chapter I'm in, and I'll select the project I want to work with.
This is a project named PreferencesWithJava. And then I'll follow the rest of the prompts to import the project into Eclipse. Once the project is imported, you'll be able to get to all the Java code; the resources, including graphic files, layout files, and menus; and everything else you need to build the application that I'm building. If you see errors when you import a project, be patient for a few moments. Eclipse sometimes takes some time to resolve internal errors before it lets you continue working.
Specifically, if you see a warning that your project has the wrong Java compliance level, that's a very common issue, and there's a very simple fix for it. Go to the project name and right-click on it. Then go down to the bottom of the Context menu and select Android Tools > Fix Project Properties. That corrects many common issues that can happen when you import Android projects into Eclipse. When you're done with the project, just delete it. You can press the Delete key, or you can right-click on the project in the Package Explorer and select Delete.
When prompted, just click OK. Don't select the option that's labeled Delete project contents on disk. As it says, you're really deleting the files. If you leave it unselected and click OK, you've just removed the project from your workspace listing, but the project is still there on your hard disk. As I mentioned, the Exercise Files folder also includes an Assets Folder. You'll find folders there that include various types of files, including graphics, XML files, and one Java JAR file that I'll use in the section on parsing XML.
And finally, the Solutions folder contains the same five chapters, but the Eclipse projects in these chapters are the completed versions-- that is, the applications in their state after I've finished each demo. If you don't want to follow along with the coding but just want to look at the finished code, you can import these projects into Eclipse. So, these exercise files should help you follow along with the demonstrations I'm doing onscreen, and you should be able to see exactly the same results that I'm getting as you create your Android application.
- Exploring local data storage options
- Creating an Android virtual device
- Starting a new project
- Defining preferences with Java and activities
- Creating and reading JSON and XML data files
- Creating a new SQLite database
- Inserting and retrieving data in the database