Black screen instead of Splash screen


I’m facing problem with Splash screen on Android. I show splash as activity’s background but it shows splash for very short time, then black screen for about 4 seconds, and finally first frame of game is visible. From time to time it works correctly, splash is visible and after few seconds main menu. Activity theme:

<style name="Theme.Splash" parent="android:Theme">
    <item name="android:windowBackground">@drawable/splash_background</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowFullscreen">true</item>

and here is my activity:

var g = new Game1();

Any ideas why such a behavior occurs ? Possible solutions to this problem ? I’m stuck with this for long time.

I’m having the same problem. It’s weird because the code worked some months ago. I’m not sure if this is a MonoGame issue or Xamarin issue.

Have you found solution ? Anybody ? I’m digging but still with no result. Sometimes it works properly, from time to time there is black screen instead of splash. What I’ve found in logs:

Choreographer(19866): Skipped 230 frames!  The application may be doing too much work on its main thread.

Should I load resources from content manager with new thread ? I mean in method LoadContent(…) I just load all resources that I need. I tried debug/release with shared runtime enabled/disabled. It happends on all builds from time to time …

I’m not sure about android but this was an issue when I developed for windows phone.
If you have content that takes more a few seconds to Load it is advisable to loaded in on a second thread then output a loading screen to the game.

Its relatively simple as Content.Load can be run on a second thread without many issues.

Isn’t Game.LoadContent running on separate thread ? I don’t have loading screen, I just have splash. When assets are loading only splash is visible. Anyhow, I can draw first frame only if all assets are loaded.

So, shall I start separate thread in Game.LoadContent and wait here on main thread until worker thread has finished ? Can anybody give me some sample, clue, hint ?

No its not. The whole loadcontent has to finish before the update and draw are called.

What you can do is have a bool loadedContent.
Set it to false.
Load up a texture and maybe a font that you can draw to the screen with.
Next start your thread to load content and make it set the loadedContent bool to true when it is finished.

Then while the loadedContent is false draw and update your loading screen. When its true draw and update your game.

Hope this helps.

But my splash is just background of activity’s style, as from Monogame samples recommendation:

<style name="Theme.Splash" parent="android:Theme">
    <item name="android:windowBackground">@drawable/splash_background</item>

Can I use this ? Probably activity will attach Game’s view with setContentView(…) immediately if assets will be loading on worker thread and Game.Draw(…) will overlap splash background ?

I really tried a lot of ideas … and spent few days on this problem. I stuck with this for long time. When I sleep thread with Thread.Sleep(), for e.g 20 secs nothing bad happens. Splash screen is still visible. I think it could simulate long assets loading. I tried to:

protected override void LoadContent(ContentManager contentManager)
Thread thread = new Thread(LoadContentTask);
            thread.IsBackground = true;


but it will stay on Join() for ever. When I tried the same but without Join() and with check in Update() and Draw() if isContentLoaded == true then it was working. But I need this splash screen only on Android … so with activity style it is perfect, except this issue.

indent preformatted text by 4 spacesif you need a work around for use android look at pre compiler commands for example

Then you can run platform based commands.
Pls not since I don’t develop on android I’m just guessing its #if ANDROID

Thanks for your answer, I know about preprocessor macros but this is not the solution for my problem. Could someone comment on the subject of loading content in Android, which leads to black screen instead of splash screen embedded as acitivity’s window background ?