Android Question (Resolved)ImageDownloader Error on Runtime

Bryanne Vega

Member
Licensed User
Longtime User
B4X:
See Below For Solution

B4X:
java.lang.IllegalStateException: Target host must not be null, or set in parameters. scheme=null, host=null, path=www.*.com/*/tutorials/fd130/sale/swipe/1.png

Here's the code:

B4X:
TutorialName = parser.NextValue
                TutorialStepCount=parser.NextValue
                urlDirectory = parser.NextValue
                Dim links As Map
                links.Initialize()
                urlDirectory = urlDirectory.Replace("+","/")
                Log(urlDirectory)
                links.Put(imageBox, (urlDirectory & CurrentStepCount & ".png"))
                CallSubDelayed2(ImageDownloader, "Download", links)


The urlDirectory is getting a VALID URL to a PNG file. the StepCounts are ok (this is used elsewere)
The response is ok.

The error occurs in the ImageDownloader module:


B4X:
    If Job.Success Then
        Dim bmp As Bitmap = Job.GetBitmap
        cache.Put(Job.JobName, bmp)
        If tasks.IsInitialized Then
            For i = 0 To tasks.Size - 1
                Dim link As String = tasks.GetValueAt(i)
                If link = Job.JobName Then
                    Dim iv As ImageView = tasks.GetKeyAt(i)
                    iv.SetBackgroundImage(bmp)
                End If
            Next
        End If
    Else
        Log("Error downloading image: " & Job.JobName & CRLF & Job.ErrorMessage)   '<<<<Here
    End If

Thanks,
 
Last edited:

Bryanne Vega

Member
Licensed User
Longtime User
Saw it, thanks for the prompt reply. I get no error. but I dont see the downloaded image. (In my imageview)

You probably forgot to add http:// to the link.


3rd edit: URL is case sensitive
 
Upvote 0

Bryanne Vega

Member
Licensed User
Longtime User
This post has been resolved, thanks Erel.

I was missing the HTTP:// and also the URL was case sensitive. Having that fixed, my UI works perfectly.
 
Upvote 0
Top