java-mesplash-screen

j2me splash screen


How to build an image-based splash screen for my j2me application?

I already have an application and I need an splash screen to attach with it.


Solution

  • You can use something like this:

    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);
        }
    }
    

    So, all you do is just create a new instance of this class and start the Thread.