B4X:
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim Timer_Test As Timer
Dim DataType As String
Dim NumberType As Int
Dim ColorType As Int
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.
End Sub
Sub Activity_Create(FirstTime As Boolean)
Timer_Test.Initialize("Timer_Test", 1000)
End Sub
Sub Activity_Resume
Timer_Test.Enabled = True
DataType = "Test1"
NumberType = 0
ColorType = 1
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'return true if you want to consume the event
End Sub
Sub Activity_Pause (UserClosed As Boolean)
Timer_Test.Enabled = False
End Sub
Sub Timer_Test_Tick
Select Case DataType
Case "Test1"
ToastMessageShow("Test1", False)
Select Case NumberType
Case 0: ToastMessageShow("NumberType 0", False)
Case 1: ToastMessageShow("NumberType 1", False)
End Select
Select Case ColorType
Case 0: ToastMessageShow("ColorType 0", False)
Case 1: ToastMessageShow("ColorType 1", False): DataType = "Test2"
End Select
Case "Test2"
ToastMessageShow("Test2", False)
End Select
End Sub
I don't know what the deal is with Select case. How many are you allowed to have inside a select case? That above code will not work properly. ToastMessageShow("Test2", False) will not get raised. B4A does not detect this error. Does Java allow this kind of coding?
Last edited: