2010-11-19 9 views
0

hie私はjde 4.5を使用しています。私のアプリを通してカメラを使いたいです。 私はコードを書いて、ランタイムexcepetionを得る非イベントスレッドによってcaaled Pushmodelscreen それの問題を教えてください?カメラの起動に問題がありますか?

ます。public voidスタートカメラ()

{ 
    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); 
     } 

}キャッチ(例外e){// TODO :扱う例外 Dialog.alert(e.getMessage());

アミット
+0

「イベントなしスレッドによるプッシュモデムスクリーン」 このエラーは、通常、画面をプッシュする前にポップアップ画面または「Dialog.alert」を表示する必要がある場合に発生します。 – Prasham

答えて

0

たくさん }} '

thnaks UIの変更に関与するコードは、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を見つけることができます。

関連する問題