Login     Sign Up
Innocent Cyril (@admin)
4 months ago
74 Views

You’ve downloaded the SDK, installed Eclipse, and plugged in the plug-in. You’re now ready to start programming for Android. Start by creating a new project and setting up your Eclipse run and debug configurations.

Starting a New Android Project

To create a new Android project using the Android New Project Wizard:

Select File ➪ New ➪ Project.

Select the Android Project application type from the Android folder, and click Finish.

In the dialog that appears (shown in Figure 2-4), enter the details for your new project. The “Project name” is the name of your project file; the “Package name” specifies its package; the “Activity name” is the name of the class that is your initial Activity; and the “Application name” is the friendly name for your application.

When you’ve entered the details, click Finish.

The ADT plug-in then creates a new project that includes a new class that extends Activity. Rather than being completely empty, the default template implements “Hello World.” Before modifying the project, take this opportunity to configure run and debug launch configurations.

Creating a Launch Confi guration

Launch configurations let you specify runtime options for running and debugging applications. Using a launch configuration you can specify the following:

❑ The Project and Activity to launch ❑ The emulator options to use

❑Input/output settings (including console defaults)

You can specify different launch configurations for Run and Debug modes. The following steps show how to create a launch configuration for an Android application:

Select Run ➪ Open Run Dialog … (or Run ➪ Open Debug Dialog …).

Right-click Android Application on the project type list, and select New.

Enter a name for the configuration. You can create multiple configurations for each project, so create a descriptive title that will help you identify this particular setup.

Now choose your start-up options. The first (Android) tab lets you select the project and Activ-ity that you want to start when you run (or debug) the application. Figure 2-5 shows the settings for the project you created earlier.

Use the Target tab to configure the emulator. There are options to choose the screen size, device skin, and network connection settings. You can also optionally wipe the user data on the emu-lator and enable or disable the start-up animation. Using the command-line textbox, you can specify additional emulator start-up options if needed.

Finally, set any additional properties in the Common tab.

Click Apply, and your launch configuration will be saved.