B4J Question Wait For (Object.runmethod()) ?

GuyBooth

Active Member
Licensed User
Longtime User
Code I am trying to run that reads a music file seems to be time sensitive - I am assuming for now that it takes too long to read the information and pass it back to its calling sub, which leads to inconsistent results.

The line of code is:
B4X:
    HasField = TagSet.RunMethod("hasField", Array(Field))
    If HasField Then
        TagValue = TagSet.runmethod("getFirst", Array(Field))
... etc
Is it possible to use runmethod asynchronously, using statements like the following:
B4X:
    Wait For (TagSet.RunMethod("hasField", Array(Field))) Complete (HasField As Boolean)
    Log($"HasField ${Field} is ${HasField}"$)
    If HasField Then
            Wait For (TagSet.RunMethod("getFirst", Array(Field))) Complete (TagValue As String)
... etc
I have tried the Wait For statements as shown but the program just stops and waits at the first Wait For statement.
 
Top