Hi, I'm trying to download a webpage to save as string using HttpUtils. I'm using 2 modules that I've downloaded: HttpUtils.bas and HttpUtilsService.bas. When I run it I get this error:
An error occurred:
(Line: xx) End Sub
java.lang.ArrayIndexOutOfBoundsException: 0
... and the cursor ends up at the End Sub of Activity_Resume, prompting me to think the problem has something to do with that subroutine.
Excuse me, this problem might be a simple bug but I'm new to B4A, so here's my simplified code:
Sub Process_Globals
Dim sServerFile As String
sServerFile="http://www.MyUrl.com"
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime=True Then
Activity.LoadLayout("View1")
HttpUtils.CallbackActivity="Main"
HttpUtils.CallbackJobDoneSub="JobDone"
PingWebsite
End If
End Sub
Sub PingWebsite
HttpUtils.Download("ping",sServerFile)
End Sub
Sub JobDone(Job As String)
Dim bSuccess As Boolean
bSuccess=HttpUtils.IsSuccess(sServerFile)
If bSuccess=True Then
Msgbox("Success!","")
End If
End Sub
Sub Activity_Resume
If HttpUtils.Complete = True Then JobDone(HttpUtils.Job)
End Sub
Thanks in advance for your help.