Android Question OkHttpUtils2

RUNO

Active Member
Licensed User
Longtime User
All attempts did not succeed
If you use each command alone, it succeeds, but both one by one does not work
Success false

I want read data from db and view image in imageview
B4X:
Dim link As String="https://xxx.bhostapp.com/picf/g.png"'  this example for images in db
    Dim job1 As HttpJob
    job1.Initialize("j", Me)
    job1.Download(link)
  
    'JobDone(job1) //// if I didn't write this command ,it didn't call function   //////   I tried
  
    Dim job2 As HttpJob
    job2.Initialize("j0", Me)
    job2.Download("https://xxx.hostapp.com/" &"part.php")
  
  
End Sub
Sub JobDone(job As HttpJob)
    If job.JobName="j" Then
   If job.Success Then
     ImageView1.Bitmap=job.GetBitmap
   Else
     Log("Error: " & job.ErrorMessage)
   End If
Else If job.JobName="j0" Then
    If job.Success=True Then
    Dim strReturn As String = job.GetString
    Dim parser As JSONParser
    parser.Initialize(strReturn)
    Dim L0 As List
    L0 = parser.NextArray 'returns a list with maps
            Log(L0.Size)
    If L0.Size >0 Then
        For i = 0 To  L0.Size-1
        If i<= L0.Size-1 Then
            Dim m As Map
            m = L0.Get(i)
            Log(m.Get("p_name"))  '' test only not all data
            End If
            Next
  
    End If
    End If 
    End If
   job.Release
End Sub
 
Top