Blackberry GPS and BlackBerry Maps 매뉴얼 - 페이지 21
{카테고리_이름} Blackberry GPS and BlackBerry Maps에 대한 매뉴얼을 온라인으로 검색하거나 PDF를 다운로드하세요. Blackberry GPS and BlackBerry Maps 35 페이지. Version: 4.7.0
Development Guide
Start a BlackBerry device application from BlackBerry Maps
You can add a menu item to BlackBerry® Maps that makes a MapView context object available based on the current location.
When a BlackBerry device user selects the menu item, the MapView context object is passed to the menu item's run()
method. The BlackBerry device user can modify the MapView information through the application's UI and view an updated
map based on that input.
1.
Open the BlackBerry® Integrated Development Environment.
2.
Create a project.
3.
Right-click the project, and click Properties.
4.
Click the Application tab.
5.
In the Arguments passed to field, type startup. Make sure the value you type matches the value in the startsWith argument
in the main method of the BlackBerry Application.
6.
Select Auto-run on startup.
7.
Select System module.
8.
Click OK.
9.
Import the following classes:
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.blackberry.api.invoke.*;
import net.rim.device.api.system.*;
import net.rim.blackberry.api.maps.*;
import net.rim.blackberry.api.menuitem.*;
10. Create a class that extends the ApplicationMenuItem class and implements the run() and toString()
methods.
private static class MapsMenuItem extends ApplicationMenuItem
{
// Constructor
MapsMenuItem()
{
// Create a new ApplicationMenuItem instance with a relative
menu
// position of 20. Lower numbers correspond to higher
placement
// in the menu.
super(20);
}
/**
* Returns the name to display in a menu.
* @return The name to display.
Displaying location information on a BlackBerry device
19