#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private xui As XUI
Dim strURL As String = "http://192.XXX.X.XX:80/loginphp/"
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
Private pnlImage As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("splashscreen")
' Sleep(2000)
' StartActivity(login)
' Activity.Finish
TestConnection
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub TestConnection
Dim Connect As HttpJob
Connect.Initialize("Connect", Me)
Connect.Download(strURL & "connection.php")
ProgressDialogShow("Connecting...")
End Sub
Sub JobDone (Job As HttpJob)
Dim phone As Phone
ProgressDialogHide
If Job.Success = True Then
Dim connMsg As String
Dim act As String
Log(Job.GetString)
connMsg = Job.GetString
Dim parser As JSONParser
parser.Initialize(connMsg)
act = parser.NextValue
If act = "Success" Then
ToastMessageShow("Login Successful",True)
phone.HideKeyboard(Activity)
End If
If act = "Failure" Then
ToastMessageShow("Login failure",True)
phone.HideKeyboard(Activity)
End If
Else
Log("Error: " & Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub