The Android Project Wizard creates all the required files for an Android application. Open Eclipse and follow these steps to create a new project:
1. Choose File, New, Android Project or click the Android Project creator icon, which looks like a folder (with the letter a and a plus sign:
^fj, ) on the Eclipse toolbar.
The first time you try to create an Android Project, you might need to choose File, New, Project and then select the Android, Android Project. After you have done this once, it appears in the Eclipse project types and you can use the method described in Step 1.
2. Choose a project name. In this case, name the project Droidl.
3. Choose a location for the project. Because this is a new project, select the Create New Project in Workspace radio button. Check the Use Default Location check box.
Did you Know?
If you prefer to store your project files in another location, simply uncheck the Use Default Location check box and browse to the directory of your choice.
4. Select a build target for your application. For most applications, you want to select the version of Android most appropriate for the devices used by your target audience and the needs of your application. If you will be using the Google add-ons (for example, Google Maps), be sure to choose the Google APIs version for your target platform. For this example, the Android 2.1 (API level 7) build target is sufficient.
5. Specify an application name. This name is what users will see. In this case, call the application Droid #1.
6. Specify a package name, following standard package namespace conventions for Java. Because all code in this book falls under the com.androidbook.* namespace, use the package name com.androidbook.droidl.
7. Check the Create Activity check box. This will instruct the wizard to create a default launch Activity class for the application. Call your activity DroidActivity.
What Is an Activity?
An activity is a core component of the Android platform. Each activity represents a task the application can do, often tied to a corresponding screen in the application user interface.
The Droid #1 application has a single activity, called DroidActivity, which has a single responsibility: to display a String to the user. We will talk more about activities in Hour 3, "Building Android Applications."
Your project settings will look as shown in Figure 1.2.
8. Confirm that the Min SDK Version field is correct. This field will be set to the API level of the build target by default (Android 2.1 is API level 7). If you want to support older versions of the Android SDK, you need to change this field. However, in this case, we can leave it as its default value.
10. The Android project wizard allows you to create a test project in conjunction with your Android application. For this example, a test project is unnecessary. However, you can always add a test project later by clicking the Android Test Project creator icon, which is to the right of the Android project wizard icon
(with the letter a, letter / and letter u: jjj1 ) on the Eclipse toolbar. Test projects are discussed in detail in Hour 22, "Testing Android Applications."
Click the Finish button.
The Android Project Wizard in Eclipse.
Was this article helpful?