Sign in to follow this  

Monogame Xamarin Back Button Fun?

Recommended Posts

So I've made a game.  It works great on my phone and on emulators.  It even closes properly.  So to complete the package I'm trying to give the back button the functionality the user would expect.  But FML.


I start with:


    public class Activity1 : Microsoft.Xna.Framework.AndroidGameActivity
        TempleMain game;

        protected override void OnCreate(Bundle bundle)

            TempleMain.Activity = this;

            Vibrator v = (Vibrator)GetSystemService(Context.VibratorService);

            game = new TempleMain(v);

and throw in 


        public override void OnBackPressed()
            if (game != null)



Now, I'm thinking that AndroidGameActivity inherits from Androids Activity yet does not override Activity's OnBackPressed() thus not giving me proper access????....  


Am I using activities wrong?  Game compiles and runs just fine.  And the home button does what you would expect without my help.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this