Click the Finish button.
Chapter 3: Your First Android Project
Setting Up an Emulator Aw, shucks I bet you thought you were about to fire up this bad boy. Well, you’re almost there. You have one final thing to cover, and then you get to see all of your setup work come to life in your Hello Android application. To see this application in a running state, you need to know how to set up an emulator through the various different launch configurations. First, you need to create an Android Virtual Device AVD, also known as an emulator. An AVD is a virtual Android device that looks, acts, walks, and talks well, maybe not walks and talks just like a real Android device. AVDs can be configured to run any particular version of Android as long as the SDK for that version is downloaded and installed. It’s time to get reacquainted with your old buddy the Android SDK and AVD Manager. Follow these steps to create your first AVD: 1. To open the Android SDK and AVD Manager, click the icon on the Eclipse toolbar shown in Figure 3-9. When the Android SDK and AVD Manager is open, you should see a dialog box similar to Figure 3-10. Figure 3-9: The Android SDK and AVD Manager icon on the Eclipse toolbar. The SDKAVD Manager Figure 3-10: The Android SDK and AVD Manager dialog box. 66 Part II: Building and Publishing Your First Android Application2. Click the New button.
The Create New Android Virtual Device AVD dialog box opens, as shown in Figure 3-11. Figure 3-11: The Create New Android Virtual Device AVD dialog box.3. For this AVD, in the Name field, type 2_2_Default_HVGA.
For more information on naming your AVDs, see the nearby sidebar “AVD nomenclature.” 4. In the Target box, select Android 2.2 — API Level 8. 5. In the SD Card section, leave the fields blank. You have no use for an SD Card in your application. You would use the SD Card option if you needed to save data to the SD Card. If you want to have an emulator in the future, insert the size of the SD Card in mega- bytes MB that you would like to have created for you. At that time, an emulated SD Card will be created and dropped in your local file system. 6. Leave the Skin option set to Default HVGA. 7. Don’t select any new features in the Hardware section. The Hardware section outlines the hardware features your AVD should emulate. You don’t need any extra hardware configuration for your first application. 67Chapter 3: Your First Android Project
Parts
» android application development for for dummies
» Developing Spectacular Android Applications
» Prepping Your Development Headquarters
» Click the New button see Figure 2-13. Click
» Click the curved-arrow icon on the right side of the screen to go to the workbench.
» Start Eclipse, if it’s not already running. 2.
» Type a name in the Name field.
» Type Prepping Your Development Headquarters
» Click the OK button. Android ADT is selected in the Work With drop-down menu, and the
» In the Build Target section, select Android 2.2.
» In the Properties section, type Hello Android in the Application Name box.
» In the Package Name box, type com.dummies.android.helloandroid.
» In the Min SDK Version box, type 8. Your screen should now look similar to Figure 3-5.
» Click the Create AVD button. Close the Android SDK and AVD Manager dialog box.
» Your First Android Project Your First Android Project
» Designing the User Interface Designing the User Interface
» Designing the User Interface
» Choose Window➪Show View➪Other. 2. Expand Java and choose Properties.
» Select the main.xml tab. 2. Add the background property to your LinearLayout:
» Verify that the definition for LinearLayout looks like this:
» Save the file. 5. Select the Layout tab to view the visual designer.
» Coding Your Application android application development for for dummies
» In Eclipse, choose Run➪Run or press Ctrl+F11 to run the application.
» Return to the home screen by clicking the home button on the emulator.
» Coding Your Application Coding Your Application
» If Eclipse is not open, open it now and open the main.xml file in the layouts
» Choose the Extract Android String option.
» Understanding Android Resources android application development for for dummies
» Turning Your Application into a Home-Screen Widget
» When the Add to Home Screen dialog box is visible, select Widgets, as shown in Figure 7-5.
» When the Choose Widget dialog box is visible, choose Silent Mode Toggle, as shown in Figure 7-6.
» Publishing Your App to the Android Market
» Click the Continue button to pay the developer fee with Google Checkout.
» On the order confirmation page see Figure 8-11, click the Place Your Order Now button.
» Click the Android Market Developer Site link.
» Read the terms and then click the I Agree, Continue link.
» On the Android developer home page refer to Figure 8-14, click the Upload Application button.
» For the Application .apk file, choose the .apk file that you created
» In the Screenshots section, add two screen shots of your application.
» Set the title of your application.
» Set the description for your application.
» Set the promo text of your application.
» Designing the Task Reminder Application
» Install the application in the emulator, and click the Menu button.
» Going a la Carte with Your Menu Going a la Carte with Your Menu
» Going a la Carte with Your Menu
» Handling User Input android application development for for dummies
» Is this a long-running task?
» Does the user need to be able to perform an advanced action in the dialog box?
» Does the user need to answer a question such as “Are you sure?” with a value of Yes or No?
» Does the user simply need to be alerted?
» Getting Persistent with Data Storage
» Reminding the User with AlarmManager
» Updating the Android Status Bar
» Working with Android’s Preference Framework
» Working with Android’s Preference Framework Working with Android’s Preference Framework
Show more