I have a panel (b4xview) that functions correctly in debug mode but not in release mode; it's a simple click panel with no special libraries involved. Can anyone suggest why this might be happening and how to resolve the issue?
B4X:
Sub CasePanel_Click
MyApp.Initialize
Dim bt As B4XView =Sender
Log(bt.Tag)
Wait For ( MyApp.GetCaseDetail("&CaseID="& bt.Tag &"&")) Complete (CaseDetail As Map)
Error
b4xmainpage$ResumableSub_CasePanel_Clickresume (java line: 984)
java.lang.RuntimeException: Object should first be initialized (B4XView).
Sub CasePanel_Click
Dim bt As B4XView =Sender 'Always first here.
MyApp.Initialize
Log(bt.Tag)
Wait For ( MyApp.GetCaseDetail("&CaseID="& bt.Tag &"&")) Complete (CaseDetail As Map)
Sub CasePanel_Click
Dim bt As B4XView =Sender 'Always first here.
MyApp.Initialize
Log(bt.Tag)
Wait For ( MyApp.GetCaseDetail("&CaseID="& bt.Tag &"&")) Complete (CaseDetail As Map)
I had an intermittent issue like this in a project. I ended up adding an "Initialization_Complete" event to my class that it raises once it's done with startup and I wait for that after initializing it before continuing.
I had an intermittent issue like this in a project. I ended up adding an "Initialization_Complete" event to my class that it raises once it's done with startup and I wait for that after initializing it before continuing.
Without seeing your code I cannot really speak to your exact issue or methodology.
In my case, I pass the instantiating activity to the class and then call back to it when finished. The activity code basically looks like:
B4X:
...
MyClass.initialize(Me)
Wait for (MyClass.Startup(Parm1, Parm2)) Initialization_Complete (Success as Boolean)
... ' more code
Wait For (MyClass.NextFunction(Parm1, Parm2)) Complete (Result as boolean)
..... ' and so on
The MyClass class saves the passed-in activity to a "myCaller" variable and uses it to callsub back as necessary, for example
B4X:
... 'doing some initial stuff, now all done
CallsubDelayed(myCaller, "Initialization_Complete", True)