Jump to content
  • Advertisement
Sign in to follow this  

Monogame Xamarin Back Button Fun?

This topic is 1372 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!