Creating Your First Program

ADT comes with a built-in example program, or template, that we're going to use to create a simple "Hello, Android" program in just a few seconds. Get your stopwatch ready. Ready? Set? Go!

Select File > New > Project... to open the New Project dialog box. Then select Android > Android Project, and click Next.

Enter the following information:

Project name: HelloAndroid Build Target: Android 2.2 Application name: Hello, Android Package name: org.example.hello Create Activity: Hello Min SDK Version: 8

When you're done, it should look something like Figure 1.3, on the next page.

Click Finish. The Android plug-in will create the project and fill it in with some default files. Eclipse will build it and package it up so it will be ready to execute. If you get an error about missing source folders, select Project > Clean to fix it.

OK, that takes care of writing the program; now all that's left is to try running it. First we'll run it under the Android emulator.

0 0

Post a comment