Android Question Updating from HttpUtils2Service

magarcan

Active Member
Licensed User
Longtime User
My phone has been updated to Android 6.0.1 and one of my apps has stopped working.
Reviewing the code it used HttpUtils2 and HttpUtils2Service. After a little bit of research I've discovered that HttpUtils2 has been replaced by OkHttp.

The fact is that I can't find a working example and I don't know what else to try:

B4X:
Sub btnPreview_Click
    Dim imgPrew As HttpJob
    imgPrew.Initialize("imgPrew", imgPrew_Complete(imgPrew))
    imgPrew.Download("http://www.mywebsite.com/image.jpg") 
End Sub

Sub imgPrew_Complete(Job2 As HttpJob)
    Log("Job2 completed: " & Job2.Success)
   
    If (Job2.Success== True) Then
        Dim bitmap1 As Bitmap
        bitmap1 = Job2.GetBitmap
        ImageView1.SetBackgroundImage(bitmap1)
        Job2.Release       
    End If
End Sub

I've seen also that imgPrew.Complete(int) is called on success, but don't have any idea how to use it.

Cheers!
 

magarcan

Active Member
Licensed User
Longtime User
My project is using those updated libraries. 8 readed somewhere that HttpUtils2Service was deprecated...
 
Upvote 0
Top