在黑莓应用程序弹出多个屏幕 [英] Popping multiple screens in a BlackBerry application

查看:136
本文介绍了在黑莓应用程序弹出多个屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写一个黑莓应用程序,它有一个用户浏览(如调查)多个屏幕。提交调查后,应用程序必须返回到开始屏幕,在这之后,他们绝不允许导航回到这是previously显示屏幕。

什么是实现这一正确的方法是什么?

目前我打电话

<$p$p><$c$c>UiApplication.getUiApplication().popScreen(UiApplication.getUiApplication().getActiveScreen());

多次有不同的屏幕。有没有可能是一个更好的解决方案,以返回到开始屏幕?


解决方案

UiApplication.getScreenCount()总会给你屏幕的数量,所以你可以这样做(从的随时随地的,它甚至没有被任何特定屏幕类):

公共无效popToRoot(){
      UIApplication的应用= UiApplication.getUiApplication();
      而(app.getScreenCount()→1){
         app.popScreen(app.getActiveScreen());
      }
   }

I writing a BlackBerry app which has multiple screens that the user navigates through (like a survey). After submitting the survey the app must return to the start screen, after which, they must not be allowed to navigate back to the screens which were previously shown.

What would be the correct way to implement this?

Currently I'm calling

UiApplication.getUiApplication().popScreen(UiApplication.getUiApplication().getActiveScreen());

as many times as there were different screens. Is there perhaps a more elegant solution to get back to the start screen?

解决方案

UiApplication.getScreenCount() will always give you the number of screens, so you can just do this (from anywhere, it doesn't even have to be from any particular Screen class):

   public void popToRoot() {
      UiApplication app = UiApplication.getUiApplication();
      while (app.getScreenCount() > 1) {
         app.popScreen(app.getActiveScreen());
      }
   }

这篇关于在黑莓应用程序弹出多个屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆