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.
Rough design of the favorite place dialog.
(Place name resolved when user
leaves focus of control)
(Show resolved GPS coordinates for location)
Was this article helpful?