Creating Your First Android Activity
10:58 PM // 0 comments // Sajib Barua // Category: Android Applications //previous Getting Started with Android
To create a new Android project using the Android New Project Wizard:
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 ProjectTo 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 fi le; 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 Configuration
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.
- 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 emulator 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.
Running and Debugging Your Android Applications
You’ve created your first project and created the run and debug configurations for it. Before making any changes, test your installation and configurations by running and debugging the Hello World project.
From the Run menu, select Run or Debug to launch the most recently selected configuration, or select Open Run Dialog … or Open Debug Dialog … to select a configuration to use.
If you’re using the ADT plug-in, running or debugging your application:
- Compiles the current project and converts it to an Android executable (.dex).
- Packages the executable and external resources into an Android package (.apk).
- Starts the emulator (if it’s not already running).
- Installs your application onto the emulator.
- Starts your application.
If you’re debugging, the Eclipse debugger will then be attached, allowing you to set breakpoints and debug your code.
If everything is working correctly, you’ll see a new Activity running in the emulator, as shown in Figure 2-6.
next Understanding Hello World

Related posts :
0 comments for this post
Leave a reply
Microsoft Word LaTeX Shortcut...
05-Nov-2020Learn Python...
23-Mar-2019A Mathematical Theory of Comm...
10-Dec-2015The Free Energy Secrets of Co...
26-Dec-2014Electronic refrigeration usin...
23-Nov-2014
- Radhika says:
Nice. Thanks for the great information. I have read many blogs but this blog is really informative....[[More detail]] - arohi patil says:
Two Stage Transformer Oil Filtration Plant - Jhun05 says:
Hi, i really needineed help,isais there anyone who can help me about this kV2c FM45s GE electric...[[More detail]] - arif says:
You possess lifted an essential offspring..Blesss for using..I would want to study better latest...[[More detail]] - Dilip says:
Very informative blog. thank you for sharing . keep posting.[[More detail]]