Pop-up menu in MG Android games?

I’m trying to display a pop-up menu in my MG Android game. I checked out this link:
http://developer.xamarin.com/guides/android/user_interface/popup_menus/

But apparently it is not as easy as utiliziing ActionSheet on iOS, and so far I haven’t had any success… So I’m wondering if there is a relatively painless way to implement a pop-up menu?

IMO you best implement it yourself, without relying on the UI framework of the different operating systems.

Hmm… it is just a “please rate the game if you like it” pop-up, and it has been done on iOS and WP8 without too much effort… Didn’t expect it could be this messy on Android…

For a “Please rate this game”, you only need a message box, such as that provided by Microsoft.Xna.Framework.GamerServices.Guide.ShowMessageBox().

Thanks @KonajuGames! But I want to provide a few buttons like “rate now”, “rate later” and “no thanks”. I don’t think a message box can contain buttons in it… :frowning:

On Android, we cater for at up to two buttons. On iOS we support more buttons.

Now I get what you are looking for. You can use my Microsoft.Xna.Framework.Input.MessageBox.Show function instead of the old one suggested by @KonajuGames. It supports up to 3 buttons and it’s cross-platform. This is what happens under the hood:

https://github.com/mono/MonoGame/blob/develop/MonoGame.Framework/Input/MessageBox.Android.cs

Thanks so much @Nezz! The message box is working like a charm! Just another quick question: could you please show me how to hook up button tap events? :smile:

Seems I can start a new task thread and use the return value of MessageBox.Show to decide what to do next:

var t = Task.Factory.StartNew( () => {
var buttonIndex = Microsoft.Xna.Framework.Input.MessageBox.Show(title, titleDescription, buttons);
CheckButtonIndex(buttonIndex.Result.Value);
return 0;
} );

If you are using async/await then:
var result = await Microsoft.Xna.Framework.Input.MessageBox.Show(...);˙
otherwise:
var result = Microsoft.Xna.Framework.Input.MessageBox.Show(...).Result;