Android Question Unable to resolve host

db0070

Active Member
Licensed User
Following the example in https://www.b4x.com/android/forum/threads/b4x-okhttputils2-with-wait-for.79345, I am getting 'Unable to resolve host' error. What am I missing?
My code is:-
B4X:
Sub Globals
    Private ImageView1 As B4XView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("1")
    DownloadImage("https://b4x-4c17.kxcdn.com/android/forum/data/avatars/m/0/1.jpg?1469350209", ImageView1)
End Sub

Sub DownloadImage(Link As String, iv As ImageView)
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Download(Link)
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        iv.Bitmap = j.GetBitmap
    End If
    j.Release
End Sub
Libraries used are Core Version 9.50, OkHttpUtils2 Version 2.82 and XUI Version 1.9

Full error is:-
ResponseError. Reason: java.net.UnknownHostException: Unable to resolve host "b4x-4c17.kxcdn.com": No address associated with hostname, Response:
 

db0070

Active Member
Licensed User
Ok, solved it - connecting to the simulator gives the error
It works on the real device
 
Top