Android Question Resumable subs return type must be ResumableSub (or none).

Hello, everyone. I need your help to solve a problem that I'm facing.

I use the below sub to retrieve the rating value from the MySQL database via PHP API and return the value. For that, I'm using Wait For (j) JobDone(j As HttpJob). Due to the resumable sub, I'm encountering the error "Resumable subs return type must be ResumableSub (or none)."


getRatings:
Sub getRatings(l As liquorInfo) As Double
    Dim rating As Double

    ' Create a Map to store the parameters
    Dim params As Map
    params.Initialize
    params.Put("action", "getRatings")
    params.Put("liquor_id", l.id)

    ' Initialize the HttpJob
    Dim j As HttpJob
    
    j.Initialize("", Me)

    ' Set the job post parameters
    j.PostMultipart("https://my_api_url/getRatings.php", params, Null)
    

    ' Wait for the job to complete
    Wait For (j) JobDone(j As HttpJob)
    
    ' Check if the job was successful
    If j.Success Then
        ' Parse the JSON response
        Log(j.GetString)
    
        Try
            ' Parse the JSON object
            Dim parser As JSONParser
            parser.Initialize(j.GetString)
            Dim result As Map = parser.NextObject
    
            ' Get the rating from the result
            rating = result.Get("average_rating")
        Catch
            Log("Error parsing JSON response.")
        End Try
        j.Release
    Else
        ' Handle the case where the HTTP request fails
        Log("HTTP request failed: " & j.ErrorMessage)
        rating = 0.0
    End If


    ' Return the rating
    Return rating
End Sub


Is there anyone who knows how to fix this?"
 

walt61

Active Member
Licensed User
Longtime User
Upvote 0
Top