#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim strUserID As String
Dim strUserName As String
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private ListView1 As ListView
Private btnLogout As Button
Private lblMessage As Label
Private lblMessage As Label
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")
Dim readtbl As HttpJob
Activity.LoadLayout("frmtrackead")
lblMessage.Text = "Welcome, " & Login.strUserName
'ToastMessageShow(currentURL, False)
readtbl.Initialize("readtbl", Me)
readtbl.Download2("http://www.myweserver.com/readtracktbl.php", _
Array As String("user_id", Login.strUserID))
ProgressDialogShow("Connecting to server...")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub JobDone (Job As HttpJob)
ProgressDialogHide
If Job.Success = True Then
Dim strReturn As String = Job.GetString
Dim parser As JSONParser
parser.Initialize(strReturn)
If Job.JobName = "readtbl" Then
Dim mytrack As List
Dim strOnline As String
mytrack = parser.NextArray 'returns a list with maps
For i = 0 To mytrack.Size - 1
Dim t As Map
t = mytrack.Get(i)
Dim TL As TwoLines
TL.First = t.Get("user_id") & t.Get("date") & t.Get("time")
TL.Second = t.Get("longitude") & t.Get("latitude")
ListView1.AddTwoLines2(TL.First, TL.Second, TL)
Next
Else If Job.JobName = "LogOut" Then
Dim act As String = parser.NextValue
If act = "LoggedOut" Then
ToastMessageShow("Logout successful", True)
StartActivity(Main)
Activity.Finish
End If
Else
ToastMessageShow("Error: Invalid Value", True)
End If
Else
'Log("Error: " & Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub