2010-11-19 6 views
0

hie 저는 jde 4.5를 사용하고 있습니다. 내 앱을 통해 카메라를 사용하고 싶습니다. 코드를 작성하고 런타임 excepetion을 얻으십시오 Pushmodelscreen 비 이벤트 스레드에 의해 caaled 무엇이 그것의 문제를 말해?카메라 시작 문제가 있습니까?

공공 무효 시작 카메라()

{ 
    try { 
// Create a player for the Blackberry's camera 
Player player= Manager.createPlayer("capture://video"); 
    // Set the player to the REALIZED state (see Player javadoc) 
     player.realize(); 
     // Grab the video control and set it to the current display 
     _videoControl = (VideoControl)player.getControl("VideoControl"); 
     if (_videoControl != null) 
     { 
      // Create the video field as a GUI primitive (as opposed to a 
      // direct video, which can only be used on platforms with 
      // LCDUI support.) 
      _videoField = (Field) _videoControl.initDisplayMode (VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field"); 
      _videoControl.setDisplayFullScreen(true); 
      _videoControl.setVisible(true); 
     } 
     player.start(); 
     if(_videoField!=null) 
     { 
     add(_videoField); 
     } 

} 캐치 (예외 전자) { // TODO : 처리 예외 Dialog.alert (e.getMessage()); } } UI 변경과 관련된 미트

+0

'이벤트가 아닌 스레드에 의한 푸시 모델링' 이 오류는 대개 화면을 팝업하기 전에 팝업 화면 또는 'Dialog.alert'가 표시되어야 할 때 발생합니다. – Prasham

답변

0

코드를 많이 `

thnaks는 UI 스레드에서 호출해야합니다. 그래서 가장 가능성이 코드의 일부는 방법으로 호출해야합니다 :

UIApplication.getUiApplication().invokeLater(new Runnable() { 
    public void run() { 
     // do your UI related staff here 
     // e.g. push a Screen or call Dialog.alert(), etc. 
    } 
}); 

또한 흥미 this info을 찾을 수 있습니다.

관련 문제