AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.SetTitle("请您输入管理员密码");
View v = LayoutInflater.From(this.ApplicationContext).Inflate(Resource.Layout.Item_alert_dialog, null);
EditText edi_admin_pwd =v.FindViewById<EditText>(Resource.Id.edi_admin_pwd);
builder.SetView(v);
builder.SetNegativeButton("确认",(der, eve)=>
{
if (edi_admin_pwd.Text == "123456")
{
Java.Lang.JavaSystem.Exit(0);
}
else
{
this.ApplicationContext.MessagesShow("密码错误!");
MyMediaPlayer.GetInstance(this).Error();
}
});
builder.SetPositiveButton("取消", (der,eve)=> { });
builder.Create();
builder.Show();
解决了 把getApplicationContext()改成this即可
http://bbs.csdn.net/topics/391069045