Designing the Favorite Place Dialog

You need to give some thought to the custom favorite place picker dialog. Again, you will build a custom dialog from the AlertDialog class.

The favorite place setting will be stored internally in three parts:

► The name of the location (a String value)

► The latitude of the location (a float value)

► The longitude of the location (a float value)

Technically, you could also retrieve and store the altitude of the location, but with most map applications these days, people want a bird's eye view on a two-dimensional space.

To keep the dialog simple, you can offer the user two choices: use the last known location (provided that the handset GPS provider exists and has this information) or enter a string into an EditText control, which the geocoding functionality available in the Android SDK translates into GPS coordinates. When you have latitude and longitude information on the location, you can include the ability to launch into the Maps application, if it is available on the device. Figure 14.3 shows a rough design of the favorite place dialog.

FIGURE 14.3

Rough design of the favorite place dialog.

FAVORITE PLACE:

(Place name resolved when user

Map It!

leaves focus of control)

COORDINATES:

(Show resolved GPS coordinates for location)

Cancel

0 0

Post a comment