Android Question Problem copying functions from a B4J code module to a B4A code module

MegatenFreak

Active Member
Licensed User
Hello.
I have a working B4J app and I'm trying to write an Android version too. A lot of the processing is in a code module in B4J, but when I tried to copy them into a B4A code module, I ran into a problem. This is one of the primary cases: I have a code module in B4J that handles HTTP requests:
B4J Code (simplified version) :
B4X:
Sub ExecQuery(ScriptURL As String, QueryString As String) As ResumableSub
    Dim Job As HttpJob
    Job.Initialize("", Me)
    Job.PostString(ScriptURL, QueryString)
    Wait For (Job) JobDone(j As HttpJob)
    If j.Success Then
        Return True
    Else
        Return False
    End If
End Sub

When I tried using the same function in a B4A code module, I got two errors:
1. Job.Initialize("", Me) -> Code modules do not support Me keyword.
2. Wait For (Job) JobDone(j As HttpJob) -> Static code modules cannot handle events.

Please tell me how to make this work. I can't just define the module as an activity; I use these functions in dozens of other modules.
How should I handle this?
Thanks a lot in advance.
 
Top