代码之家  ›  专栏  ›  技术社区  ›  user366312

J2ME启动屏幕

  •  1
  • user366312  · 技术社区  · 16 年前

    如何为我的J2ME应用程序构建基于图像的启动屏幕?

    我已经有了一个应用程序,我需要一个启动屏幕来附加它。

    2 回复  |  直到 16 年前
        1
  •  2
  •   Malcolm    16 年前

    您可以使用如下内容:

    class SplashScreenSwitcher extends Thread {  
    
        private Display display;
        private Displayable splashScreen;
        private Displayable nextScreen;
    
        public SplashScreenSwitcher(Display display, Displayable splashScreen, Displayable nextScreen) {
             this.display = display;
             this.splashScreen = splashScreen;
             this.nextScreen = nextScreen;
        }
    
        public void run() {
             display.setCurrent(splashScreen);
             try {
                  Thread.sleep(2000); //Here you set needed time or make a constant
             } catch (Exception ex) {}
             display.setCurrent(nextScreen);
        }
    }
    

    所以,您所做的只是创建这个类的一个新实例并启动线程。

        2
  •  3
  •   Salgar    16 年前

    J2ME没有默认的“闪屏”方法,它只需要显示几秒钟的图片,然后进行下一个显示。如果你真的想要,你可以利用这个时间在后台加载其他东西。

    This is a tutorial by Sun on splash screens