ネットワーク機能を使用するBlackberryのアプリケーションを開発しています。あなたがTimeOutThreadを参照してHttpHelper両方彼らは実行の主な流れの外に呼び出すことができるように、スレッドから継承することができたようネットワークスレッドをブロックするUI
mainButton=new BitmapButton(Bitmap.getBitmapResource("elcomercio.gif"), Bitmap.getBitmapResource("elcomercio.gif"), Field.FOCUSABLE){
protected boolean navigationClick(int status,int time) {
//It automatically add itself to the screen stack
waitScreen=new WaitScreen();
TimeOutThread timeOut=new TimeOutThread(HomeScreen.this, 10000);
HttpHelper helper=new HttpHelper("http://www.elcomercio.com/rss/latest", null, HomeScreen.this, HttpHelper.GET);
UiApplication.getUiApplication().invokeLater(timeOut);
UiApplication.getUiApplication().invokeLater(helper);
return true;
}
};
:要求は、次のコードでは、ボタンを押すことで実行されます。また、それらの両方はデリゲートオブジェクトとして現在のScreenを受け取るので、後でメソッドを画面上で実行できます。この場合、timeoutは次の関数を実行します。タイムアウトメソッドが呼び出されたsucessfully
public void onTimeout() {
if(!didTimeout.booleanValue()){
UiApplication.getUiApplication().popScreen(waitScreen);
didTimeout=Boolean.TRUE;
}
}
...でも、待機画面はsucessfully poppedOutで、最後の画面を示しましたさ。しかし、その時点でUIがハングしています...私が持っていたHttpThreadのように、UIをブロックしています...ネットワークスレッドがタイムアウトすると、UIが再び応答するためです。私が間違っているのは何ですか?