Skip to main content

how to do work behind splash? doing it postSplash still doesnt work

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2011-08-29

I would think that doing the "hard work" of my app in postSplash() before I go to another form would be the perfect way to do it. However I load the app it does all of the hardwork then goes right into the app (presumably showing the splash *extremely* briefly - question - how do I keep my splash up while the hard work is done of initialising my app (loading text files, rms etc etc) then have it vanish after? rather than the user has to sit and wait 10 secs and thinks app hasnt worked then it appears with no splash.

PostSplash is kind of misleading in this respect how do others do this? I guess I could have a timer that wait a while so splash is painted, then does the hard work then after that goes into my app?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2011-08-29

OK - I used a timer and this solved the problem, i guess the thread needed time to paint the splash before stealing the cpu, the code for it goes something like this:

protected void postSplash(Form f) {
// If the resource file changes the names of components this call will break notifying you that you should fix the code

//keep splash on we need a timer to let it display first
Timer timer = new Timer();
timer.schedule( new CountDown(), 200 ); //after splash has been on a short while we do the "hard work" behind it.


//the delay allows splash screen to paint for a while before we steal the cpu for our intensive stuff.
//thus splash is left on screen whilst this happens.
//Splash screen timer class
// ----------------------------------------
private class CountDown extends TimerTask
public void run(){
_("SPLASH TIMER DONE, calling doInit();");

_("splash is done decide where to go now");