Android Question Download2

Almora

Active Member
Licensed User
Longtime User
hi..
I want to display the image. but I get the error. Where am I doing wrong.

error: incompatible types: String[] cannot be converted to ImageViewWrapper



B4X:
DownloadImage("https://website.com/1.x/?lang=en_US", _
     Array As String("ll", EditText2.Text & "," & EditText1.Text, "z",17,"size", 450 & "," & 450,"l","sat",ImageView1))



B4X:
Sub DownloadImage(Link As String, iv As ImageView)
    Dim j As HttpJob
    j.Initialize("",Me)
    
    j.Download2(Link, _
    Array As String("key1", "value1", "key2", "value2"))
    Wait For (j) JobDone (j As HttpJob)
    If j.Success Then
        iv.Bitmap=j.GetBitmap
    End If
    j.Release
End Sub
 

ronell

Well-Known Member
Licensed User
Longtime User
what was the servers response? i guess that it is returning a string not images
B4X:
log(j.GetString)
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
the second argument in DownloadImage is imageview but u gave it a string array.
inside the DownloadImage there is a dummy array that u would replace by function argument.
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
DownloadImage(1, 2, 3) this call looks wrong
Sub DownloadImage(1,2)
 
Upvote 0

ronell

Well-Known Member
Licensed User
Longtime User
just remove the second argument in the sub,
B4X:
DownloadImage("https://website.com/1.x/?lang=en_US")
Sub DownloadImage(Link As String)
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
this is wrong, the imageview is part of the string array :)
("ll", EditText2.Text & "," & EditText1.Text, "z",17,"size", 450 & "," & 450,"l","sat",ImageView1)
 
Upvote 0

ronell

Well-Known Member
Licensed User
Longtime User
try this

B4X:
DownloadImage("https://website.com/1.x/",ImageView1)

Sub DownloadImage(Link As String, iv As ImageView)
    Dim j As HttpJob
    j.Initialize("",Me)
   
    j.Download2(Link, _
    Array As String("lang","en_US","ll", EditText2.Text & "," & EditText1.Text, "z",17,"size", 450 & "," & 450,"l","sat"))
    Wait For (j) JobDone (j As HttpJob)
    If j.Success Then
        iv.Bitmap=j.GetBitmap
    End If
    j.Release
End Sub
 
Last edited:
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
lang=en_US is also a parameter for this string array.
"lang","en_US"

the ? in url means here starts parameters and there are separated by &
its done in Download2 for you.
 
Upvote 0
Top