Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim hc As HttpClient
Dim hrp As HttpResponse
Dim hrq As HttpRequest
'In the designer also add the following 3
Dim Button1 As Button
Dim EditText1 As EditText 'this is the url, it MUST start with http://
Dim EditText2 As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("layout")
hc.Initialize("hcstart") 'hcstart will be the prefix of our response, see below
End Sub
Sub Button1_Click
hrq.InitializeGet(EditText1.Text)
hc.Execute(hrq, 2) 'fetches the url, remember the http://
End Sub
Sub hcstart_ResponseError (Reason As String, StatusCode As Int, TaskId As Int)
Msgbox("fail:" & reason, StatusCode)
End Sub
Sub hcstart_ResponseSuccess (Response As HttpResponse, TaskId As Int)
Msgbox(Response, "success")
EditText2.Text = Response.GetString("utf-8")
End Sub