从一个 BlackBerry 屏幕启动另一个屏幕
最近,我在对 BlackBerry 应用程序进行最后润色时遇到了障碍。我正在构建一个登录屏幕,如果用户成功登录,则进入数据加载屏幕,然后进入主屏幕。您可以在主屏幕上使用该应用程序。一切都很好,但有一件事,我无法无缝地从登录屏幕移动到加载屏幕,再到主屏幕。我可以从登录屏幕移动到加载屏幕,因为我是通过单击 GUI 线程上的按钮来执行此操作的,但随后我的登录屏幕位于堆栈底部,无法将其取出使用解雇方法。进入加载屏幕后,我无法推送主屏幕,因为我不是通过 gui 方法执行此操作,尽管我可以通过以下代码段更新 GUI:
private void checkData(){
Timer loadingTimer = new Timer();
TimerTask loadingTask = new TimerTask()
{
public void run()
{
// set the progress bar
progressGaugeField.setValue(DataManager.getDataLoaded());
// for repainting the screen
invalidate();
}
};
loadingTimer.scheduleAtFixedRate(loadingTask, 500, 500);
}
有谁知道如何解决我的问题从登录屏幕无缝移动到加载屏幕再到主屏幕?注意:一旦我进入主屏幕,我希望它成为堆栈上唯一的屏幕。
谢谢!
I've recently run into a snag while putting on the finishing touches for my BlackBerry app. I'm building a login screen which, if the user is successful in logging in, goes to a data loading screen, and then to a home screen. From the home screen, you can use the app. Everything works great but one thing, I can't seamlessly move from the login screen to the loading screen, to the home screen. I can move from the login screen to the loading screen ok, because I'm doing that via a button click which is on the GUI thread, but then I have the login screen at the bottom of the stack and can't get it out using the dismiss method. Once in the loading screen, I can't push the home screen because I'm not doing it via the gui method, though I'm able to update the GUI via the following piece of code:
private void checkData(){
Timer loadingTimer = new Timer();
TimerTask loadingTask = new TimerTask()
{
public void run()
{
// set the progress bar
progressGaugeField.setValue(DataManager.getDataLoaded());
// for repainting the screen
invalidate();
}
};
loadingTimer.scheduleAtFixedRate(loadingTask, 500, 500);
}
Does anyone know how to solve my problem of moving seamlessly from the login screen to the loading screen to the home screen? Note: once I'm at the home screen I'd like to have it be the only screen on the stack.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在这种情况下,您可能需要先推送应用程序的主屏幕,然后再推送登录屏幕。我不确定您的情况,但这是我所做的假设:
如果这些假设合理有效,那么下面的代码应该可以很好地为您工作。
In this case, you may want to push the home screen of your application first and then push the login screen after it. I am not sure of your situation, but here are the assumptions I am making:
If these assumptions are reasonably valid, the below code should work nicely for you.
您是否尝试过首先将主屏幕放入堆栈(从应用程序),如果尚未尝试登录,则推送登录屏幕?反过来,登录屏幕可以推送加载屏幕。加载完成后,将其从堆栈中弹出(从登录)并 close() 登录。然后,您将返回主屏幕,并显示已登录的用户。
为了使加载工作并跟踪其进度,您可以使用以下代码
Have you tried putting the main screen on the stack first (from the Application) and, if no login has been attempted yet, push the login screen? In turn the login screen can push the loading screen. Once loading is completed, pop it out of the stack (from login) and close() login. You will then be back on the main screen with a logged in user.
For the loading to work and track its progress, you can use the following code
如果您在代码中知道何时需要推动屏幕,则可以使用 UiApplication PushScreen 函数。首先获取具有 UI 的当前应用程序的句柄:
您可以比较活动屏幕以验证它是您的应用程序:
然后您可以使用 UiApplication 实例推送新屏幕:
我希望有所帮助:)
If you know in code when you need to push the screen, you can use the UiApplication pushScreen function. You start by getting a handle to the current application that has the UI:
You can compare the active screen in order to verify it's your application:
Then you can use the UiApplication instance to push your new screen:
I hope that helps :)