I take the spirit of those few line in beginner's guide
I have used the designer to place my buttons so I don't initialize them
I keep button1 out of the array to compare result
The problem is that all my buttons defined in the array "Buttons" don't seem to work : in debug mode I place "stop" on the Buttons_click but I never reach it ???
here is the code :
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim Button1 As Button
Dim Button2 ,Button3, Button4, Button5, Button6, Button7, Button8, Button9, Button10, Button11,Button12 As Button
Dim Buttons() 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("Layout1")
Activity.LoadLayout("test_button")
Buttons = Array As Button(Button2, Button3, Button4, Button5, Button6, Button7, Button8, Button9, Button10, Button11, Button12)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Buttons_Click
Dim btn As Button
btn = Sender
Log("Button " & btn.Tag & " clicked") 'write the line to LogCat
End Sub
Sub Button1_Click
Log("Button " & Button1.Tag & " clicked") 'write the line to LogCat
Log("I am here")
End Sub
I have used the designer to place my buttons so I don't initialize them
I keep button1 out of the array to compare result
The problem is that all my buttons defined in the array "Buttons" don't seem to work : in debug mode I place "stop" on the Buttons_click but I never reach it ???
here is the code :
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim Button1 As Button
Dim Button2 ,Button3, Button4, Button5, Button6, Button7, Button8, Button9, Button10, Button11,Button12 As Button
Dim Buttons() 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("Layout1")
Activity.LoadLayout("test_button")
Buttons = Array As Button(Button2, Button3, Button4, Button5, Button6, Button7, Button8, Button9, Button10, Button11, Button12)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Buttons_Click
Dim btn As Button
btn = Sender
Log("Button " & btn.Tag & " clicked") 'write the line to LogCat
End Sub
Sub Button1_Click
Log("Button " & Button1.Tag & " clicked") 'write the line to LogCat
Log("I am here")
End Sub