If think this is a bug. I am building using B4A 10.0, Android 9, Samsung Galaxy Tab Active2, portrait orientation
Summary
This line of code causes the program to hang. It may process a few more lines of UI related code, but it will eventually freeze. For this example, Result = true.
Refactoring it into these two lines of code resolves the issue.
Small example project attached. When using the "bad" code, the button on the layout is never displayed...essentially the UI thread is hung.
Summary
This line of code causes the program to hang. It may process a few more lines of UI related code, but it will eventually freeze. For this example, Result = true.
Bad code:
wait for (Method2) Complete (Result As Boolean) : If Not(Result) Then Return
Refactoring it into these two lines of code resolves the issue.
Good code:
wait for (Method2) Complete (Result As Boolean)
If Not(Result) Then Return
Complete sample:
#Region Project Attributes
Sub Process_Globals
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
End Sub
Sub Activity_Resume
CallSubDelayed(Me, "Method_BAD") 'Change this to either Method_OK or Method_BAD to illustrate the bug.
End Sub
Sub Button1_Click
ToastMessageShow("Hello world!", False)
End Sub
Sub Method_OK()
wait for (Method2) Complete (Result As Boolean)
If Not(Result) Then Return
End Sub
Sub Method_BAD
wait for (Method2) Complete (Result As Boolean) : If Not(Result) Then Return
End Sub
Sub Method2() As ResumableSub
Return True
End Sub
Small example project attached. When using the "bad" code, the button on the layout is never displayed...essentially the UI thread is hung.