Error occurred on line: 811 (clsConexion)
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.ref.WeakReference.get()' on a null object reference
at anywheresoftware.b4a.keywords.Common.Msgbox2Async(Common.java:486)
at anywheresoftware.b4a.objects.B4XViewWrapper$XUI.MsgboxAsync(B4XViewWrapper.java:786)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:777)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:354)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:146)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:7506)
at android.view.View.performClickInternal(View.java:7483)
at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
at android.view.View$PerformClick.run(View.java:29335)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7898)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
-----
I think the problem is that there is no 'PAGE' where to associate or link the XUI.MsgboxAsync (I don't know how to explain it).
This has led me to transfer my function to B4XMainPage and that is how it is solved, but it would be interesting to know what happens in this case in which a module has a class, which launches XUI.MsgBoxAsyn
Solution:
PUBLIC Sub MiMsgBoxCsBuilder(M1 As String, M2 As String)
B4XPages.MainPage.MiMsgBoxCsBuilder(M1,M2)
Return
And in B4xMainPage:
PUBLIC Sub MiMsgBoxCsBuilder(M1 As String, M2 As String)
Try
xui.MsgboxAsync (m1,m2)
Catch
Log(LastException)
'XUI.MsgboxAsync(M1,M2)
End Try
End Sub