2011-04-28 3 views
0

의 인스턴스를 내가 블랙 베리 데모 클래스 다음과 같은 문제가 :이 데모 실행을 얻기 위해 Eclipse와 블랙 베리 시뮬레이터를 사용하고 내가 얻을는 MenuItem을

MenuItem locatorItem = new MenuItem(new StringProvider("Location Search"), 0x230020, 0); 
      locatorItem.setCommand(new Command(new CommandHandler() 
      (...) 

오류 '유형의 MenuItem 인스턴스화 할 수 없습니다'를. 왜 그런지 모르겠고 해결할 제안이 없습니다. 'net.rim.device.api.ui.MenuItem;'을 (를) 가져 왔습니다.

답변

0

잘못된 유형의 MenuItem을 사용하고 있다고 생각합니다. net.rim.device.api.ui.MenuItem은 Blackberry 전용입니다.

J2ME 응용 프로그램/미드 레트 인 경우 javax.microedition.lcdui.Command 만 작성하면됩니다. 그들은 블랙 베리에 메뉴 항목으로 설정되어 있습니다.

function doSomething() { 
    // Your Code Here 
} 

// In the function building your screen 
MenuItem somethingMi = new MenuItem() { 
    private MenuItem() { super("Do Something",100001, 5); } 

    public void run() { doSomething() }; 
} 

addMenuItem(somethingMI); 
:

당신은 또한 net.rim.device.api.ui.Screen 또는 응용 프로그램의 다른 net.rim 클래스를 사용하는 경우,이 메뉴 항목은 일반적으로 생성되는 방법입니다