MVVM light Xamarin Android - DialogService 抛出错误

MVVM light Xamarin Android - DialogService throws error

我正在使用 MVVM ligth 和 Xamarin Android。如果我想显示一条消息,我会得到 Java.Lang.NullPointerException.

示例代码:

private void MeldenButton_Click(object sender, EventArgs e)
    {
        var ds = new DialogService();
        ds.ShowMessage("Test", "Testnachricht"); 
    }

原始代码如下所示:

if (await this._dialogService.ShowMessage(
    string.Format("Soll die Musterbestellung \"{0}\" gelöscht werden?",
    this._musterBestellung.Bezeichnung), "Löschbestätigung", "Ja", "Nein",
                 null))

我收到错误消息 System.MissingMethodException:找不到方法 'Builder.SetOnDismissListener'。

有什么想法吗?

周末愉快
彼得

自己寻找答案:
Java.Lang.NullPointerException 被抛出,因为活动不是 ActivitBase!!!

System.MissingMethodException: Method 'Builder.SetOnDismissListener' not found. 被抛出,因为这个函数是在 Level 17 中引入的,我尝试使用 DialogService with API-16级。我的愚蠢错误!

对不起!

**自己找答案: Java.Lang.NullPointerException 被抛出,因为该活动不是 ActivitBase!!!

System.MissingMethodException:未找到方法 'Builder.SetOnDismissListener'。被抛出是因为此功能是在第 17 级中引入的,我尝试将 DialogService 与 API-第 16 级一起使用。我的愚蠢错误! **