Splash screen - how I did it - but not best way

Monkey Targets Forums/Android/Splash screen - how I did it - but not best way

matty(Posted 2011) [#1]
Hi All,

I've been looking for a way to do a splash screen for my game while it loads (it takes a good 10 seconds on my phone).

It seems that we cannot call "OnRender" during the "OnCreate" method.

First thing I tried was perhaps to have two Apps extending the mojo app and run them in succession, but that didn't seem to work.

What I did do that works but seems kludgy is this:

During OnCreate load the splash screen.
The first time through OnUpdate load the rest of the media, then in the first time through OnRender draw the splash screen.

What I have found is that although it works - I'm not sure it is the way I should be doing it. The reason is that my phone gives a warning message that the app may have frozen if the user presses the screen during the load time..but it still loads fine. If the user doesn't press the screen it loads no problem.

Also - I tried doing a progress bar by updating it each time I loaded a new file but I found that it doesn't really work the way I thought. It seems that the files get loaded into my app quickly but the uploading of the images to the video memory takes a long time and happens after I've already loaded all the files.


Samah(Posted 2011) [#2]
You'll need to load one image on each OnRender, I think. Call LoadImage, then DrawImage offscreen (to force it to upload to video memory).

Also, you cannot have more than one App class (in an Android application at least), since there can only be one entrypoint activity.


MikeHart(Posted 2011) [#3]
Did you try the OnLoading event? It is surpose to be used to render something while resources are loaded.


dave.h(Posted 2011) [#4]
ive tried onloading and had no luck but maybe i did something wrong


MikeHart(Posted 2011) [#5]
Maybe it is only for loading stuff during the onUpdate Event. Never tried it myself.


slenkar(Posted 2011) [#6]
I suppose the only way to do what you want would be to create a new thread, one for onCreate and one for 'onLoading',

would be difficult for someone who has never used threads in java before though