Blackberry GPS and BlackBerry Maps Handbuch - Seite 24
Blättern Sie online oder laden Sie pdf Handbuch für Software Blackberry GPS and BlackBerry Maps herunter. Blackberry GPS and BlackBerry Maps 35 Seiten. Version: 4.7.0
Development Guide
13. Create a menu item that displays the latitude, longitude, and zoom values from the MapView context object.
private MenuItem viewMapItem = new MenuItem("View Map", 1000, 10)
{
public void run()
{
// Change the zoom level.
_mapview.setZoom( _zoomField.getSelectedValue() );
try
{
(_latitudeField.getText()));
(_logitudeField.getText()));
>= 18000000 || longitude < -18000000)
MapsArguments(_mapview));
close();
}
catch(RuntimeException re)
{
occur :
}
}
};
14. Populate the menu.
protected void makeMenu( Menu menu, int instance )
{
super.makeMenu( menu, instance );
// If _zoomField has focus , make "Change Option" item default.
if(getFieldWithFocus() == _zoomField)
{
22
int latitude = (int) (100000 * Double.parseDouble
int longitude = (int) (100000 * Double.parseDouble
if (latitude > 9000000 || latitude < -9000000 || longitude
{
throw new IllegalArgumentException ();
}
_mapview.setLatitude(latitude);
_mapview.setLongitude(longitude);
// Invoke BlackBerry Maps with a MapView object.
Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, new
// An exception is thrown when any of the following
// Latitude is invalid : Valid range: [-90, 90]
// Longitude is invalid : Valid range: [-180, 180)
// Minus sign between 2 numbers.
Dialog.alert("Invalid Longitude and/or Latitude");
_latitudeField.setFocus();
Displaying location information on a BlackBerry device