B4X:
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Public Page2 As pag2
End Sub
Public Sub Initialize
Page2.Initialize
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
B4XPages.AddPage("Page2", Page2)
End Sub
Private Sub B4XPage_Appear
B4XPages.ShowPage("Page2")
Wait For (Page2.DoSomething) Complete(Unused As Boolean)
Log("Completed: " & Unused)
B4XPages.ClosePage("Page2") ' <---- this line causes an error at runtime.
End Sub
Error message:
** Activity (main) Resume **
Completed: true
Error occurred on line: 185 (B4XPagesManager)
java.lang.NullPointerException: Attempt to read from field 'java.lang.String b4a.example.b4xpagesmanager$_b4xpageinfo.Id' on a null object reference
at b4a.example.b4xpagesmanager._closepage(b4xpagesmanager.java:256)
at b4a.example.b4xpages._closepage(b4xpages.java:42)