简体   繁体   中英

MVVM light Xamarin Android - DialogService throws error

I am using MVVM ligth with Xamarin Android. If I want to show a message I get a Java.Lang.NullPointerException .

Sample Code:

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

In the original code it looks like this:

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

and I get the errormessage System.MissingMethodException: Method 'Builder.SetOnDismissListener' not found.

Any ideas?

Have an nice Weekend
Peter

FIND the answer myself:
Java.Lang.NullPointerException was thrown because the activit is not a ActivitBase !!!

System.MissingMethodException: Method 'Builder.SetOnDismissListener' not found. is thrown because this function was introduced in Level 17 and I try to use the DialogService with API-Level 16. Stupid error of me!

Sorry!

**FIND the answer myself: Java.Lang.NullPointerException was thrown because the activit is not a ActivitBase !!!

System.MissingMethodException: Method 'Builder.SetOnDismissListener' not found. is thrown because this function was introduced in Level 17 and I try to use the DialogService with API-Level 16. Stupid error of me! **

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM