1 How to achieve it ?
To properly setup Gear SplashScreen, all you have to do is create some keys inside the JAD file:
- "SplashScreenImage:" -> contains a string with the path to the desired background image
- "SplashScreenText:" -> contains a string with the desired text
If you are developing your application inside Eclipse with MTJ plugin (former EclipseME), you can easily achieve this by opening the Application Descriptor tab and "Add" the two key-value entries.
If your development environment is a different one, you have to manually insert those keys inside your application's JAD file.
As long as there is at least one of the two keys inside your JAD file, Gear will display the SplashScreen, so if you don't want it, simply don't specify anything.
2 Writing initialization code
Now that the SplashScreen is enabled, all you have to do is to override a single method inside your MIDlet
protected void onMidletInitializationComplete()
and fill it with your custom initializzation logic. We encourage users to follow this practice to put setup code inside this function rather than into the GearMIDlet constructor so they can take advantage from SplashScreen avoiding user interface freezes.
Here is an example of a possible implementation:
protected void onMidletInitializationComplete() {
// Call some custom initializzation methods
initDatabase();
doSomeHeavyDutyWork();
initUserInterface();
// ... and finally show the user the UI
EventManager.getInstance().enqueueEvent(new DisplayWidget(this, LoginForm.class));
}
3 The result
Gear's SplashScreen can display an image background, text and comes with an animated throbber centered vertically and anchored to the bottom of the screen. This is a possible result obtained with it:
Unfortunately this screen-shot is just a static image and you can't actually see the spinning animation of the throbber.