Sub Process_Globals
Private timer1 As Timer
Private targetTime As Long
End Sub
Sub Globals
Private EditText1 As EditText
Private Go As Button
Private Label1 As Label
Private Pause As Button
Private Reset As Button
Private Set As Button
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("timerlayout")
If FirstTime Then
timer1.Initialize("timer1", 1000)
End If
StartTimer(4)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub StartTimer ( minutes As Int)
targetTime = DateTime.Now + minutes * DateTime.TicksPerMinute
End Sub
Sub Timer1_Tick
Dim t As Long = Max(0, targetTime - DateTime.Now)
Dim minutes, seconds As Int
minutes = (t Mod DateTime.TicksPerHour) / DateTime.TicksPerMinute
seconds = (t Mod DateTime.TicksPerMinute) / DateTime.TicksPerSecond
Log($"$1.0{minutes}:$1.0{seconds}"$)
End Sub
Sub Set_Click
End Sub
Sub Reset_Click
End Sub
Sub Pause_Click
timer1.Enabled = False
End Sub
Sub Go_Click
timer1.Enabled = True
End Sub