Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private Panel1 As Panel
Private EditText1 As EditText
Private t As Timer
Private count As Int
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("1")
Panel1.Initialize("Panel1")
EditText1.Initialize("EditText1")
Panel1.Color=Colors.LightGray
EditText1.TextSize=20
Activity.AddView(Panel1,0,0,100%x,50%y)
Activity.AddView(EditText1,0,75%y,100dip,40dip)
t.Initialize("timer1", 1000) 'max time (milisecs) between taps which will be counted
End Sub
Sub Panel1_Touch (Action As Int, X As Float, Y As Float)
Log(Action & " x=" & x & " y=" & Y)
If Action = 1 Then
If t.Enabled Then
count = count + 1
t.Enabled=True
Else
count = 1
t.Enabled=True
End If
End If
End Sub
Sub timer1_tick
t.Enabled=False
EditText1.Text = "Taps " & count
End Sub