Next try: I moved the sub to Main. That works.
I have to refactor the whole App to replace MsgBox with MsgboxAsync. When I have to move each and any MsgBox out of the Class modules, that will be an desaster. I know it's better to du UI in the Activities, but there are many places it would get very expensive to move any UI out of the Classes.
For clarity, here the excerpt of the relevant subs:
[CODE lang="b4x" title="Main"]Private Sub findeLizenz As ResumableSub
Dim fd As FileDialog
'[...]
If fd.Show("Lizenz-Datei suchen","OK","Abbruch","",Null) <> DialogResponse.POSITIVE Then
MsgboxAsync("Benutzerabbruch, kein Lizenz übernommen", "Lizenz")
Wait For MsgBox_Result (Result As Int)
Return False
End If
'[...]
Wait For (Lizenz.showLeseErgebnis(stat)) Complete (Result As Int)
Return stat = Lizenz.DATEISTATUS_OK
End Sub
[/CODE]
[CODE lang="b4x" title="Lizenz"]Public Sub showLeseErgebnis(status As Int) As ResumableSub
Dim txt As String
Select status
Case Lizenz.DATEISTATUS_OK: txt = "Lizenz wurde gespeichert."
Case Lizenz.DATEISTATUS_WRONGPROG: txt = "Die Lizenz-Datei gehört nicht zu " & sProgLizenzName
Case Lizenz.DATEISTATUS_NOCHECK: txt = "MAC Adresse und IMEI sind nicht verfügbar, Lizenz kann nicht geprüft werden!" & CRLF & _
"Das WLAN muss zur Prüfung eingeschaltet sein!"
Case Lizenz.DATEISTATUS_WRONGMAC: txt = "Die Lizenz-Datei gehört nicht zu diesem Gerät mit MAC: " & ALLG.GetDeviceMAC
Case Lizenz.DATEISTATUS_WRONGIMEI: txt = "Die Lizenz-Datei gehört nicht zu diesem Gerät mit IMEI: " & ALLG.GetDeviceId
Case Lizenz.DATEISTATUS_WRONGKEY: txt = "Der Lizenz-Key ist falsch, bitte an Support wenden."
Case Else: txt = "Interner Fehler: Status " & status
End Select
Dim sf As Object = Msgbox2Async(txt, "Lizenzprüfung", "OK", "", "", LoadBitmap(File.DirAssets, "btn_info.png"), False)
Wait For (sf) MsgBox_Result (Result As Int)
Return 0
End Sub
[/CODE]