Android Question Response.GetAsynchronously problem

Firpas

Active Member
Licensed User
Longtime User
Hi to everybody

I have a problem getting the response of an OkHttpResponse Object.

Here is my code:

B4X:
Sub wc_ResponseSuccess (Response As OkHttpResponse, TaskId As Int)
    ProgressDialogHide
    If Response.ContentType = "text/plain; charset=UTF-8" Then
        Dim Out As OutputStream = File.OpenOutput(File.DirDefaultExternal, "Log.txt", False)
        Log(Response.GetAsynchronously("GetResponse", Out, True, TaskId))
    End If
End Sub

Sub GetResponse(Success As Boolean, TaskId As Int)
    If Success Then
        Dim In As InputStream = File.OpenInput(File.DirDefaultExternal, "Log.txt")
        Dim Reader As TextReader
        Reader.Initialize(In)
        Log(Reader.ReadAll)
        In.Close
    Else
        Log(LastException)
    End If
End Sub

And here is the log:

true
java.lang.Exception: Sub getresponse_streamfinish was not found.

I`ve attached a screenshot.

Any idea??

Thanks in advance
 

Attachments

  • ScreenShot.png
    48.7 KB · Views: 229

DonManfred

Expert
Licensed User
Longtime User
Why are you not usng okHTTPutils?
 
Upvote 0

Firpas

Active Member
Licensed User
Longtime User
I`m sending a message trhough GCM

Now SOLVED

Callback must nemed GetResponse_StreamFinish inestead of GetResponse

I think this help is not very clear (see attached image)

Thnaks
 

Attachments

  • ScreenShot2.png
    54.9 KB · Views: 326
Last edited:
Upvote 0
Top