私はスクリーンネームを持っていますDownloaderScreenスクリーンが始まるといくつかのファイルがダウンロードされ、ダウンロードが完了すると自動的に次のスクリーンに進みます。私は次のコードを使用しています。ブラックベリースクリーンナビゲーション
public DownloaderScreen() {
super(NO_VERTICAL_SCROLL | NO_HORIZONTAL_SCROLL | USE_ALL_HEIGHT
| USE_ALL_WIDTH);
this.application = UiApplication.getUiApplication();
HorizontalFieldManager outerBlock = new HorizontalFieldManager(USE_ALL_HEIGHT);
VerticalFieldManager innerBlock = new VerticalFieldManager(USE_ALL_WIDTH | FIELD_VCENTER);
innerBlock.setPadding(0, 10, 0, 10);
outerBlock.setBackground(BackgroundFactory
.createBitmapBackground(LangValue.dlBgimg));
outerBlock.add(innerBlock);
add(outerBlock);
phraseHelper = new PhraseHelper();
final String[][] phraseList = phraseHelper.getDownloadList();
gaugeField = new GaugeField("Downloading ", 0, phraseList.length, 0, GaugeField.PERCENT);
innerBlock.add(gaugeField);
Thread dlTread = new Thread() {
public void run() {
startDownload(phraseList);
}
};
dlTread.start();
}
private void startDownload(String[][] phraseList){
if(phraseList.length!=0){
for(int i=0; i < phraseList.length ; i++){//
gaugeField.setValue(i);
// code for download
}
}
goToNext();
}
private void goToNext() {
final Screen currentScreen = application.getActiveScreen();
if (UiApplication.isEventDispatchThread()) {
application.popScreen(currentScreen);
application.pushScreen(new HomeScreen());
} else {
application.invokeLater(new Runnable() {
public void run() {
application.popScreen(currentScreen);
application.pushScreen(new HomeScreen());
}
});
}
}
コードが正常に動作していると開始は、ファイルをダウンロードし、ダウンロードが完了すると、それは次の画面に前進されます。しかし、ダウンロードするファイルがない場合は、配列の長さが0であるphraseList
は、それは進んでいません。私のコードの問題は何ですか?