使用等待窗口的话,黑莓中有Dialog和Status两种已封装的弹出窗口类型。这两种类型都不能显示动态的信息。也就是说如果使用网络更新之类的就很难去实现,用Status来的话时间的控制就变的很麻烦了。
如果使用自定的的窗口,必须继承PopupScreen类。但是必须使用以下结构才能实现。
boolean onNext()
{
Executed when the user presses 'next' (run in the EDT)
boolean success = false;
new Thread(new Runnable()
{
public void run()
{
// 尝试连接网络获取数据
// ...
success = true;
// 关闭等待进程窗口
/ ...
}
}).start();
// 显示等待窗口到界面中
UiApplication.getUiApplication().pushModalScreen(progressPopup);
// 返回网络操作的状态
return success;
}