CHAPTER 7: Making Apps Interactive: Intents, Event Handling, and Menus 243
If you now use the Graphical Layout tab, as shown in Figure 7-27, you can see your UI design is in
alignment!
Figure 7-27. Previewing the layout_below and layout_alignLeft parameters for your
Since we are going to want to preview this RelativeLayout UI design and EditGalaxy Activity
subclass in the Nexus One AVD emulator at some point here, before our curiosity gets the best of
us, we need to take a quick break from UI design and add the
new EditGalaxy class to the Android Manifest XML file. We will do this so that when this Activity is
“called” using the Intent object we created for the application, the app does not crash! If you wish
to see what that crash would look like were you not to add the Activity to the manifest, simply use
your trusty Run As ➤ Android Application menu sequence now, and click on the Edit Galaxy Info
MenuItem! Kah-Blamm! Let’s do something to avoid this crash scenario!
Adding EditGalaxy to Your App: Editing Your AndroidManifest
Let’s take a break and add the EditGalaxy class to your AndroidManifest.xml file, so that when we
want to test this UI design in the Nexus One AVD emulator, the application won’t crash. Since we
use explicit Intent object Java code in order to launch the EditGalaxy Activity subclass, we will not
need to define any IntentFilter object structures, such as the MainActivity features, so all that we will
be required to add is the following XML markup:
<activity
android:name="absolute.beginners.hellouniverse.EditGalaxy"
android:label="@string/edit_galaxy" >