加载屏幕在黑莓手机上不起作用?
我想在黑莓上实现加载屏幕。我尝试以下代码 使用以下代码支持论坛链接
PleaseWaitPopupScreen.showScreenAndWait(new Runnable() {
public void run() {
//**Segment 1** here i write the code for network call
}
}, "please wait");
// **Segment 2**:Here processing the data get from network call
问题是第 2 段在完成第 1 段之前起作用。我也尝试使用以下代码,但
HorizontalFieldManager popHF = new HorizontalFieldManager();
popHF.add(new LabelField("Pls wait..."));
final PopupScreen waitScreen = new PopupScreen(popHF);
new Thread()
{
public void run()
{
synchronized (UiApplication.getEventLock())
{
UiApplication.getUiApplication().pushScreen(waitScreen);
}
// **Segment 1**Here Some Network Call
synchronized (UiApplication.getEventLock())
{
UiApplication.getUiApplication().popScreen(waitScreen);
}
}
}.start();
// **Segment 2**:Here processing the data get from network call
出现了同样的问题。任何帮助将不胜感激。
谢谢
I want to implement a loading screen in blackberry. I try the code from following Support forum link using following code
PleaseWaitPopupScreen.showScreenAndWait(new Runnable() {
public void run() {
//**Segment 1** here i write the code for network call
}
}, "please wait");
// **Segment 2**:Here processing the data get from network call
the problem is the segment 2 works before completing the segment 1. I also try the following code
HorizontalFieldManager popHF = new HorizontalFieldManager();
popHF.add(new LabelField("Pls wait..."));
final PopupScreen waitScreen = new PopupScreen(popHF);
new Thread()
{
public void run()
{
synchronized (UiApplication.getEventLock())
{
UiApplication.getUiApplication().pushScreen(waitScreen);
}
// **Segment 1**Here Some Network Call
synchronized (UiApplication.getEventLock())
{
UiApplication.getUiApplication().popScreen(waitScreen);
}
}
}.start();
// **Segment 2**:Here processing the data get from network call
the same problem arises. Any help will be appreciated.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实际上,这取决于您在段 2 中执行的操作。如果没有 UI 操作,则只需将段 2 移动到进行 http 调用的线程内即可。例如:
但是如果段 2 中有 UI 操作,则在弹出等待屏幕后立即在 UI 线程上调用它:
Actually it depends on what you're doing in segment 2. If there is no UI actions, then just move segment 2 inside the thread that makes http call. e.g.:
But if there are UI actions inside of segment 2, then call it on UI thread, right after you pop off the wait screen: