Thoughts on How To Implement Splash Screen on Android?

When starting my SDL-based Android app, there is a noticeable period of a solid black screen before the app is loaded and ready to go. I would like to implement a splash screen of anything,for example a simple static image in order to let the user know the app is loading, and their phone didn’t go to sleep/crash.

I tried overriding onCreate() from SDLActivity and creating a new Layout/ImageView, but this gets supplanted immediately when SDLActivity calls setContentView(), and thus it doesn’t even get displayed. Has anyone successfully implemented a splash screen for an SDL-based app? If so, what did you do? All ideas/suggestions are welcome. Thanks in advance!

Lazy foo , Google his examples and you’ll see a great splash screenOn Feb 23, 2014 4:09 PM, “jlev31415” wrote:

When starting my SDL-based Android app, there is a noticeable period of
a solid black screen before the app is loaded and ready to go. I would like
to implement a splash screen of anything,for example a simple static image
in order to let the user know the app is loading, and their phone didn’t go
to sleep/crash.

I tried overriding onCreate() from SDLActivity and creating a new
Layout/ImageView, but this gets supplanted immediately when SDLActivity
calls setContentView(), and thus it doesn’t even get displayed. Has anyone
successfully implemented a splash screen for an SDL-based app? If so, what
did you do? All ideas/suggestions are welcome. Thanks in advance!


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

How long is your test device taking to finish initializing SDL and getting
the window set up? My apps don’t have much of a delay at all before they
can show something.

Jonny D

@R Maynard: I could not find any Lazy Too tutorials/examples regarding Android-based splash screens. All his stuff appears to be general, basic SDL tutorials. If you could provide a link to the page with which you are referring, it would be appreciated.

@Jonny D: Running a Galaxy S4, which is no slouch, my app takes between 1-2 seconds before it starts drawing. I’m fairly sure I could cut some more time off with a little optimization, and some of the delay may be due to running a debug build, however, I’m concerned that even if I make it tolerable on this device, the discrepancy in hardware out in the field could exemplify the delay on other devices. Out of curiosity, what device are you running, and what kind of delay are you seeing? Are you running a release build? If so, have you noticed a significant improvement vs. a debug build?

What I have done was to initialise as very little as possible, then
displayed a static image. Then I continued my initialisation. The
static image (the splash) then gets replaced once my main loop kicks
in.

For example, my initialisation looks something like this:

SDL_Init
SDL_CreateWindow
SDL_CreateRenderer
Mix_Init
Mix_OpenAudio
TTF_Init

IMG_Load(/super_awesome_splash_image.png/)

SDL_SetRenderColor(/white/)
SDL_RenderClear

SDL_RenderCopy(/texture of the splash image/)
SDL_RenderPresent

/clean up/

Admitantly, a more barebones initialisation would not include
SDL2_mixer and SDL2_ttf initialisation. On the limited number devices
I have tested (Galaxy Tab 10.1, Galaxy Tab 2 7.0, emulator) I don’t
see much of the splash screen. SDL2 seems to load fairly fast. In
fact, I had to introduce a 1s delay after calling SDL_RenderPresent
just so I could see it.

Hope this helps.

AlvinOn Sun, Feb 23, 2014 at 6:09 PM, jlev31415 wrote:

When starting my SDL-based Android app, there is a noticeable period of a
solid black screen before the app is loaded and ready to go. I would like to
implement a splash screen of anything,for example a simple static image in
order to let the user know the app is loading, and their phone didn’t go to
sleep/crash.

On my Samsung Vibrant (Galaxy S) running CyanogenMod, it takes roughly 1.5
seconds from when I touch the icon to when my loading screen appears.
About 0.5 seconds is taken up by the launcher’s own animation (a black box
growing to the screen size). There’s no noticeable difference between my
debug and release builds.

Jonny D

The examples that lazy foo has are cross platform in their sdl. I was
saying you could use his splash screen method in one thread and loading the
other.

Hello,

I do a static splash screen, on android, in a very convenient way :

In the file “AndroidManifest.xml”, I use the theme “splashScreenTheme” :

Which is defined in “res/values/style.xml” :

@drawable/splash_shelf

It uses a drawable “res/drawable/splash_shelf.xml” :

Which is, in fact, a splash screen image file “res/drawable/splash_screen.png”.

Hope it helps, Cheers,

SylvainOn Mon, Feb 24, 2014 at 8:28 PM, R Manard wrote:

The examples that lazy foo has are cross platform in their sdl. I was saying
you could use his splash screen method in one thread and loading the other.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Sylvain Becker

@Sylvain: Thank you for the detailed reply! This is exactly along the lines of what I am attempting to do. Unfortunately, though, I tried setting things up as you described, and I am having the same issue I had with my previously mentioned attempt. The splash screen is only shown for a brief flash (actually it’s almost impossible to see because it’s gone before the app has grown to full-screen size), because when SDLActivity launches, it immediately creates a new layout, overriding the layout containing the splash screen, which causes the screen to go black again until everything is initialized and I’m able to draw. Is there anything special you’re doing in your app initialization in order to keep the splash screen up longer?

@Jonny D: Thanks for the info. I’m also running Cyanogenmod (CM11). It seems like we both have similar timings. It seems to vary quite a bit for me - does it for you? I assume it’s just due to whatever background process happens to be running at the time.

@Alvin Beach: Thanks. I thought doing whatever I could to optimize my initialization and get something up on the screen ASAP, but I was hoping to avoid this and use the tools already available with the Android platform in order to have an Android-only splash screen that doesn’t need to be crammed into my cross-platform code if I can help it.