Black Screen after Resume

Hi there

i’m using the latest MonoGame Version (3.2.0) with the API Level 18 but i still got a Blackscreen after resuming the App. How can i fix this ?

My GameActivity Class looks like this

public class ActivityGame : AndroidGameActivity
    {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            RequestWindowFeature(WindowFeatures.NoTitle);
            Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);

            Game.Activity = this;
            var g = new Game();
SetContentView(g.Window);

            g.Run();
        }
    }

Are you using any textures that you’ve created at runtime? If so those need to be re-created after resume.

This has been fixed since 3.2 but there is not a new stable release yet. Use a build from the buildbot or the git repo

Unfortunately, its not working and i still have a black Screen after resuming. I used the latest Master Brunch on Github for the Libraries “Lidgren.Network” and “MonoGame.Framework”.

Here is my Code:

GameActivity.cs
[Activity(Label = “My cool Game”,
MainLauncher = true,
Icon = “@drawable/Icon”, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden,
Theme = “@android:style/Theme.NoTitleBar.Fullscreen”,
ScreenOrientation = ScreenOrientation.Portrait, NoHistory=false)]
public class ActivityGame : AndroidGameActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);

            MyGame.Activity = this;
            var g = new MyGame();
            SetContentView(g.Window);
            g.Run();
        }
    }

if i use the latest Version from NuGet (3.2.2), i always got an NullReferenceException.

[mono] Unhandled Exception:
[mono] System.NullReferenceException: Object reference not set to an instance of an object
[mono] at Microsoft.Xna.Framework.Content.ContentManager.ReloadGraphicsAssets () [0x00000] in :0
[mono] at Microsoft.Xna.Framework.Content.ContentManager.ReloadGraphicsContent () [0x00000] in :0
[mono] at
Microsoft.Xna.Framework.AndroidGameWindow.b__0
(System.Object o) [0x00000] in :0

Found the Solution:

  1. Installed the latest Development Build (v3.2)
  2. changed GameActivity.cs

public class ActivityGame : AndroidGameActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
var g = new MyGame();
SetContentView((View)g.Services.GetService(typeof(View)));
g.Run();
}
}