Implementing the Favorite Place Dialog Layout

You need to create a new layout file where you can store the favorite place dialog layout. For this purpose, you add a new layout resource called /res/layout/fav_place_dialog.xml to the project.

This layout is pretty straightforward. All custom dialog controls are encapsulated within a vertically oriented LinearLayout control. First, you have a TextView control to display the label for choosing a favorite place. Next, you need to display the

EditText input control for the user to type the place name, next to a Button control to allow the user to launch the Map application. You can easily organize the EditText and the Button controls side-by-side, using RelativeLayout. Finally, you include two TextView controls: one to display the label for the GPS coordinates and one to show the actual GPS coordinate data (which is read-only in the Been There, Done That! application).

Figure 14.4 shows the layout for the Favorite Place picker dialog.

FIGURE 14.4

The favorite place dialog layout.

LinearLayout (Vertical Orientation)

TextView ("Favorite Place:")

RelativeLayout

EditText (Favorite Place Input)

(Launch Map)

TextView ("Coordinates:")

TextView ("Coordinates:")

TextView (Show GPS Coordinates)

0 0

Post a comment