Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim edtUserName, edtPassword As EditText
Dim btnLogin As Button
Dim MyJob As HttpJob
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
edtUserName.Initialize("")
edtPassword.Initialize("")
edtPassword.PasswordMode = True
btnLogin.Initialize("Login")
btnLogin.Text = "Login"
Activity.AddView(edtUserName, 0, 0, 100%x, 40dip)
Activity.AddView(edtPassword, 0, edtUserName.Top + edtUserName.Height, 100%x, 40dip)
Activity.AddView(btnLogin, 0, edtPassword.Top + edtPassword.Height, 100%x, 40dip)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Login_Click
ProgressDialogShow2("Please Wait...", False)
MyJob.Initialize("Login", Me)
MyJob.PostString("http://www.traveloista.com/traveloista.asmx/LoginUser", "UserName=" & edtUserName.Text & "&Password=" & edtPassword.Text)
End Sub
Sub JobDone (Job As HttpJob)
ProgressDialogHide
Select Case Job.JobName
Case "Login"
If Job.Success Then
Log(Job.GetString)
If Job.GetString.Contains(">true<") Then
Log("Login > OK")
Else
Log("Login > Failed")
End If
Else
'an error occurred
End If
End Select
Job.Release
End Sub