BlackBerry应用程序中的闪屏

BlackBerry应用程序中的闪屏,blackberry,java-me,Blackberry,Java Me,我正在开发一个黑莓应用程序,该应用程序启动时需要一个启动屏幕。我没有发现任何实现启动屏幕的示例 我在应用程序的start类中使用了计时器来显示飞溅图像。 这个问题还有别的解决办法吗 要为黑莓智能手机应用程序创建启动屏幕,必须扩展MainScreen类,需要使用按键和导航事件,并且可以使用计时器在一定时间后关闭屏幕。 public class SplashScreen extends MainScreen { private MainScreen next; private UiAp

我正在开发一个黑莓应用程序,该应用程序启动时需要一个启动屏幕。我没有发现任何实现启动屏幕的示例

我在应用程序的start类中使用了计时器来显示飞溅图像。
这个问题还有别的解决办法吗

要为黑莓智能手机应用程序创建启动屏幕,必须扩展MainScreen类,需要使用按键和导航事件,并且可以使用计时器在一定时间后关闭屏幕。

public class SplashScreen extends MainScreen {
   private MainScreen next;
   private UiApplication application;
   private Timer timer = new Timer();
   private static final Bitmap _bitmap = Bitmap.getBitmapResource("image.png");
   public SplashScreen(UiApplication ui, MainScreen next) {
      super(Field.USE_ALL_HEIGHT | Field.FIELD_LEFT);
      this.application = ui;
      this.next = next;
      this.add(new BitmapField(_bitmap));
      SplashScreenListener listener = new SplashScreenListener(this);
      this.addKeyListener(listener);
      timer.schedule(new CountDown(), 5000);
      application.pushScreen(this);
   }
   public void dismiss() {
      timer.cancel();
      application.popScreen(this);
      application.pushScreen(next);
   }
   private class CountDown extends TimerTask {
      public void run() {
         DismissThread dThread = new DismissThread();
         application.invokeLater(dThread);
      }
   }
   private class DismissThread implements Runnable {
      public void run() {
         dismiss();
      }
   }
   protected boolean navigationClick(int status, int time) {
      dismiss();
      return true;
   }
   protected boolean navigationUnclick(int status, int time) {
      return false;
   }
   protected boolean navigationMovement(int dx, int dy, int status, int time) {
      return false;
   }
   public static class SplashScreenListener implements
      KeyListener {
      private SplashScreen screen;
      public boolean keyChar(char key, int status, int time) {
         //intercept the ESC and MENU key - exit the splash screen
         boolean retval = false;
         switch (key) {
            case Characters.CONTROL_MENU:
            case Characters.ESCAPE:
            screen.dismiss();
            retval = true;
            break;
         }
         return retval;
      }
      public boolean keyDown(int keycode, int time) {
         return false;
      }
      public boolean keyRepeat(int keycode, int time) {
         return false;
      }
      public boolean keyStatus(int keycode, int time) {
         return false;
      }
      public boolean keyUp(int keycode, int time) {
         return false;
      }
      public SplashScreenListener(SplashScreen splash) {
         screen = splash;
      }
   }
}

公共类SplashScreen扩展了主屏幕{
私有主屏幕下;
私人应用程序;
专用计时器=新计时器();
私有静态最终位图_Bitmap=Bitmap.getBitmapResource(“image.png”);
公共SplashScreen(UiApplication ui,主屏幕下一个){
super(Field.USE_ALL_HEIGHT | Field.Field_LEFT);
this.application=ui;
this.next=next;
添加(新位图字段(_位图));
SplashScreenListener=新的SplashScreenListener(此);
this.addKeyListener(listener);
时间表(新倒计时(),5000);
应用程序。推屏(本);
}
公众假期{
timer.cancel();
application.popScreen(this);
应用程序。推屏(下一步);
}
私有类倒计时扩展TimerTask{
公开募捐{
DismissThread dThread=新DismissThread();
调用器(dThread);
}
}
私有类DismissThread实现可运行{
公开募捐{
解雇();
}
}
受保护的布尔导航单击(int状态,int时间){
解雇();
返回true;
}
受保护的布尔导航取消单击(整数状态,整数时间){
返回false;
}
受保护的布尔导航移动(int-dx、int-dy、int-status、int-time){
返回false;
}
公共静态类侦听器实现
键盘监听器{
私人屏幕;
公共布尔keyChar(字符键、int状态、int时间){
//截取ESC和菜单键-退出启动屏幕
布尔retval=false;
开关(钥匙){
case Characters.CONTROL_菜单:
case Characters.ESCAPE:
screen.disclose();
retval=true;
打破
}
返回返回;
}
公共布尔键关闭(整数键代码,整数时间){
返回false;
}
公共布尔键重复(int-keycode,int-time){
返回false;
}
公共布尔键状态(int-keycode,int-time){
返回false;
}
公共布尔键控(整数键控码,整数时间){
返回false;
}
公共SplashScreen侦听器(SplashScreen splash){
屏幕=飞溅;
}
}
}