Featured interfaces


This interface defines an individual location picker, such as a GPSLocationPicker or a MapsLocationPicker. Location pickers are objects that contain the following: a display name, a method for selecting a location through invoking the locationPicked(LocationPicker.Picker picker, Landmark location) method, and a method for cancelling a request that is in progress. The LocationPicker.Picker interface is nested within the LocationPicker class, and works in conjunction with the LocationPicker.Listener interface.

The sample application creates LocationPicker.Picker objects to wrap individual location pickers. The LocationPicker.Picker object then adds these to a LocationPicker object which is added to the screen.


This interface receives events when a location is selected, or when a selection is canceled. The interface has only one implementable method, locationPicked(LocationPicker.Picker picker, Landmark location), which is invoked when a user selects a location. The LocationPicker.Listener interface is nested within the LocationPicker class, and works in conjunction with the LocationPicker.Picker interface.

The sample application implements the locationPicked method to display the name, description, latitude, and longitude of a location picker when that location picker is selected. If BlackBerry® Maps is present on the device, it is invoked from this method, and displays the selected location.

Files in the sample application


This file defines two classes, the LocationPickerDemo class and its nested class, LocationPickerDemoScreen.

The LocationPickerDemo class extends the UiApplication class, and contains the following constructor and methods:

  • main(String[] args): provides the entry point to the sample application and starts the main thread using UiApplication.enterEventDispatcher()
  • LocationPickerDemo(): constructs a new LocationPickerDemo object which pushes a LocationPickerDemoScreen onto the display stack

The LocationPickerDemoScreen class extends the MainScreen class, and implements the LocationPicker.Listener and FieldChangeListener interfaces. It contains the following constructor and methods:

  • LocationPickerDemoScreen(): initializes the screen by creating LabelField, ButtonField and LocationPicker.Picker objects used in the sample application
  • locationPicked(LocationPicker.Picker picker, Landmark location): implements of the LocationPicker.Listener interface, and displays the name, description, latitude and longitude stored in the LocationPicker.Picker object when selected by the user
  • fieldChanged(Field field, int context): implements the FieldChangeListener class, and listens for the user to press the "Choose location" button, then displays the menu when the button is pressed

Resource files




Icon for the Location Picker Demo application.

Next topic: System requirements
Previous topic: Featured classes

Was this information helpful? Send us your comments.