Android Question Problems with Wait for

Dey

Active Member
Licensed User
This is just a test
It does not work, where it blurs
Alleged example
thank you

B4X:
'Activity Main
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim csOne As ClassOne
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    csOne.Initialize(Me)
    Test
End Sub

Sub Test
    Dim options As List = Array("Select 1", "Select 2", "Select 3")
    InputListAsync(options, "Select Color", 0, False)
    Wait For InputList_Result (Index As Int)
   
    If Index <> DialogResponse.CANCEL Then
        Log("Selected color: " & options.Get(Index))
    End If
    Msgbox2Async("You have selected " & options.Get(Index),"MSG BOX ASYNC","Ok","","No",Null,True)
    Wait For Msgbox_Result (Result As Int)
   
    If Result = DialogResponse.POSITIVE Then
        csOne.Test
        Wait For Prova_result(value As String)
        Msgbox2Async("You have selected " & value,"CLASS ONE","Ok","","No",Null,True)
         Wait For Msgbox_Result (Result As Int)
         Test
         Return
    End If
    Test

End Sub

'Class ClassOne
Sub Class_Globals
    Dim mCallBack As Object
End Sub

'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(CallBack As Object)
    mCallBack=CallBack
End Sub

Sub Test
    Dim options As List = Array("Red", "Green", "Blue")
    InputListAsync(options, "Select Color", 0, True)
    Wait For InputList_Result (Index As Int)
    If Index <> DialogResponse.CANCEL Then
        Log("Selected color: " & options.Get(Index))
        CallSubDelayed2(mCallBack,"Prova_result",options.Get(Index))
        Return
    End If
    CallSubDelayed2(mCallBack,"Prova_result","No select")
   
End Sub
 

Attachments

  • TestWaitFor.zip
    7.6 KB · Views: 112

Dey

Active Member
Licensed User
It is a bug in the new Async dialogs. The events are raised in the activity instead of the class. It is fixed for the next update.

For now you should use the modal dialogs calls in the class.

Thanks Erel
In BETA versions it was ok
I had converted many into Async
And I had to go back
These new features are very important and make the code easier to handle!
Thanks again for the work and assistance that from Anywhere Software

P.S. When do you plan to release the update?
 
Upvote 0
Top