Blackberry GPS and BlackBerry Maps 매뉴얼 - 페이지 24
{카테고리_이름} Blackberry GPS and BlackBerry Maps에 대한 매뉴얼을 온라인으로 검색하거나 PDF를 다운로드하세요. Blackberry GPS and BlackBerry Maps 35 페이지. 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