Android Question OkHttpResponse unknown member: GetString

RichyK68

Active Member
Licensed User
Longtime User
Hi all, I've just returned to an older project to rebuild it on my phone (can't find the APK), but it doesn't build. I've on version B4A V6.31. It's something to do with having to move from httputils2 to okhttputils2 and http to okhttp, which I've done, but the error I get now is on:

B4X:
Sub WebClient_ResponseSuccess(Response As OkHttpResponse, TaskId As Int)
    If TaskId = 1 Or TaskId = 2 Then
        Dim suburb As String = "", street As String = ""
        Try
            Dim resultString As String
            resultString = Response.GetString("UTF8")
blah blah blah

The line Response.GetString("UTF8") is not recognised. WebClient is the registered handler via

B4X:
dim webclient as OkHttpClient
webclient.Initialize("WebClient")

If I can't do GetString anymore on the OkHttpResponse object, how do I get the response?

Thanks,

Richard
 

DonManfred

Expert
Licensed User
Longtime User
You should use okhttputils instead of the httpclient directly.
 
Upvote 0

RichyK68

Active Member
Licensed User
Longtime User
My bad. It was old code that was no longer used that was stopping it from compiling. I had moved the code over to use HttpJob long ago. I've now commented out the offending code.

Cheers :)
 
Upvote 0
Top