【问题标题】:Alertdialog error in Xamarin (Mono) AndroidXamarin (Mono) Android 中的 Alertdialog 错误
【发布时间】:2013-05-12 16:51:06
【问题描述】:

我在互联网上搜索并找不到解决方案。这是我可以发展自己的最好的。但我在第一行得到错误。我收到此错误:

Error CS0428: Cannot convert method group 'Create' to non-delegate type 'Android.App.AlertDialog'. Did you intend to invoke the method? (CS0428)

我的代码是:

AlertDialog alertMessage = new AlertDialog.Builder(this).Create;

alertMessage.SetTitle("MobileSecure Key:");

alertMessage.SetMessage(cipherText);

alertMessage.Show();

【问题讨论】:

    标签: c# android xamarin.android xamarin


    【解决方案1】:

    一个简单的答案是尝试通过添加一些括号Create()来调用该方法

    除此之外,还有一个很好的对话框介绍,包括许多示例,这些示例展示了如何在http://blog.ostebaronen.dk/2013/02/using-dialogs-in-mono-for-android.html?m=1 上调用它们

    【讨论】:

      【解决方案2】:
      AlertDialog.Builder alert = new AlertDialog.Builder(this);
              alert.SetTitle("msgConfirm");
              alert.SetMessage("msgSureExit");            
              Dialog dialog = alert.Create();
              dialog.Show();
      

      我希望这会对某人有所帮助:)

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-02-14
        相关资源
        最近更新 更多