I started developing Android apps today using Visual Studio 2015 and I'd like to know why I can't show an AlertDialog, because it throws me an exception about Android.Views.WindowManagerBadTokenException
and I don't see where I'm mistaken..
private void Button_Click(object sender, EventArgs e)
{
((Button)sender).Text = string.Format("{0} clicks!", count++);
try
{
AlertDialog.Builder builder = new AlertDialog.Builder(this.ApplicationContext);
builder.SetTitle("This is a title..");
builder.SetMessage("This is a message..");
AlertDialog ad = builder.Create();
ad.Show();
}
catch (Exception ex)
{ ((Button)sender).Text = ex.Message; }
}