Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Home")
okClient.Initialize("getCategories")
okClient.Execute(Session.requestAllCategories,1000)
End Sub
Sub okClient_ResponseSuccess (Response As OkHttpResponse, TaskId As Int)
Dim out As OutputStream
out.InitializeToBytesArray(0)
Log(out)
Response.GetAsynchronously("res", out, False, TaskId)
End Sub
Sub res_StreamFinish (Success As Boolean, TaskId As Int)
Log($" ${Success}"$)
Log(out)
If Success Then Log(BytesToString(out.ToBytesArray, 0, out.ToBytesArray.Length, "utf8"))
End Sub
Sub okClient_ResponseError (Response As OkHttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
Log($"Error: ${Response.ErrorResponse}, ${Reason}, ${StatusCode}"$)
If Response <> Null Then Response.Release
End Sub