'Activity module
Sub Process_Globals
Dim ImageUrl, PostUrl As String
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
' 192.168.1.2 is my computer
' my ZTE Blade is always assigned an IP address of 192.168.1.4 on my local network
ImageUrl = "http://192.168.1.2/google.gif"
' ImageUrl = "http://www.b4x.com/android/images/logo2.png"
End If
HttpUtils.CallbackActivity = "Main"
HttpUtils.CallbackJobDoneSub = "JobDone"
HttpUtils.CallbackUrlDoneSub = "UrlDone"
HttpUtils.Download("GET Job1", ImageUrl) 'start
End Sub
Sub Activity_Resume
'Check whether a job has finished while the activity was paused.
If HttpUtils.Complete = True Then JobDone(HttpUtils.Job)
End Sub
Sub UrlDone(Url As String)
'Log(Url & " done")
End Sub
Sub JobDone (Job As String)
If Job = "GET Job1" Then
If HttpUtils.IsSuccess(ImageUrl) Then
Dim b As Bitmap
b = HttpUtils.GetBitmap(ImageUrl)
Activity.SetBackgroundImage(b)
Else
' whats the error?
End If
End If
HttpUtils.Complete = False 'Turn off the complete flag so we won't handle it again if the activity is resumed.
End Sub