I have an rest api get method which return Image URL.I would like to know how to set this Image URL in Image control .i have tried below code but its shows an error message "java.lang.classCasstException: can not be cast to android.graphics.bitmap"
Public Sub GetImage(URL As String, Parameters() As String, Token As String) As ResumableSub
Dim Result As String
Dim j As HttpJob
Try
j.Initialize("", Me)
j.Download2(Main.Link & URL, Parameters)
'j.GetRequest.SetContentType("application/json")
'j.GetRequest.SetHeader("Content-Length",Parameters.Length)
If Not(Token.Length = 0) Then
j.GetRequest.SetHeader("Authorization", $"Bearer ${Token}"$)
End If
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Result = j.GetString
JSON.Initialize(Result) 'Read the text from a file.
Map1 = JSON.NextObject
Log(Map1.Get("ImageURL"))
ImgEmp.SetBackgroundImage(Map1.Get("ImageURL"))
Else
'xui.MsgboxAsync( j.Response.ErrorResponse,"")
Result = j.Response.ErrorResponse
End If
Catch
Log(LastException)
xui.MsgboxAsync(LastException,"exception")
End Try
j.Release
Return Result
End Sub
Public Sub GetImage(URL As String, Parameters() As String, Token As String) As ResumableSub
Dim Result As String
Dim j As HttpJob
Try
j.Initialize("", Me)
j.Download2(Main.Link & URL, Parameters)
'j.GetRequest.SetContentType("application/json")
'j.GetRequest.SetHeader("Content-Length",Parameters.Length)
If Not(Token.Length = 0) Then
j.GetRequest.SetHeader("Authorization", $"Bearer ${Token}"$)
End If
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Result = j.GetString
JSON.Initialize(Result) 'Read the text from a file.
Map1 = JSON.NextObject
Log(Map1.Get("ImageURL"))
ImgEmp.SetBackgroundImage(Map1.Get("ImageURL"))
Else
'xui.MsgboxAsync( j.Response.ErrorResponse,"")
Result = j.Response.ErrorResponse
End If
Catch
Log(LastException)
xui.MsgboxAsync(LastException,"exception")
End Try
j.Release
Return Result
End Sub