Last version of MG for Android

I’m trying to make some testing on the latest version of MG (from sources). I’m unable to run a simple test app because:

  • The static property Activity is now read only for Game class (it should be handled internally now)
  • I can’t use the Game.Window property with the SetContentView method of the Activity. What I need to use?

this is my code for the activity

[Activity (
    Label = "MonoGame", 
    MainLauncher = true,
    Icon = "@drawable/icon",	    
    AlwaysRetainTaskState=true,
    LaunchMode=LaunchMode.SingleInstance,
    ConfigurationChanges = ConfigChanges.Orientation | 
                           ConfigChanges.KeyboardHidden | 
                           ConfigChanges.Keyboard)]
public class MainActivity : AndroidGameActivity
{
    private Game1 _game;

    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);

        _game = new Game1();            
        _game.Run();
    }
}

Missed the already opened topic. Sorry :frowning:

You need to set the content view before running your game. Change OnCreate to this:

    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);

        _game = new Game1();            
        SetContentView(_game.Services.GetService<View>()); // this is new
        _game.Run();
    }

Thank youy nanexcool.

I’m wondering why this is not done internally by MG :open_mouth: