CHAPTER 7: Making Apps Interactive: Intents, Event Handling, and Menus 233
It would be nice to be able to mouse-over this error and have Eclipse create the new XML file for
you, just like it did on the Java side of things, but unfortunately, this option has not been added to
the error pop-up yet, so we will need to create an XML UI Layout definition file for ourselves. You
can also see the work process for this in Figure 7-15, which involves a right-click on the /res/layout
folder and the selection of the New ➤ Android XML File menu sequence, which will bring up the
New Android XML File dialog, seen on the right-hand side of Figure 7-15.
Since you right-clicked on the /res/layout folder, the Layout XML resource type is already set for
you, as is the project name, so all you have to do is to name the file activity_edit, and select a
RelativeLayout container type in the main (central) area of the dialog. After you configure everything,
click the Finish button, and the file will be created for you, and will also be opened up for you inside
of the Eclipse central editing pane.
Creating an EditGalaxy UI: Using a RelativeLayout
Since we learned about the LinearLayout class in the previous chapter, and since the
RelativeLayout class is the next most commonly used layout container class in Android application
UI design, we’re going to use this class to design our Edit Galaxy Info screen in this section of the
chapter. I want to cover more unique and advanced UI layout container classes in the next chapter
on UI layout (container) design, so I am going to cover these two layout container classes in these
first two chapters that include UI design topics in them. UI design in Android simply cannot be
covered using one chapter; in fact, Apress has an entire book, called Pro Android UI, by Wallace
Jackson (Apress, 2014) covering this topic alone! Thus, I will be covering some of the UI-related
topics from this Pro Android UI book title during Chapters 6 through 12, including the different layout
Figure 7-15. Copy onCreate( ) method from MainActivity, change UI XML to activity_edit, New ➤ Android XML File