Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private clv As CustomListView
Private editsList As List
Private btncheck 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("main")
editsList.Initialize
For i = 1 To 120
clv.Add(CreateListItem(i, "Item #" & i, clv.AsView.Width, 50dip), 50dip, "Item #" & i)
Next
Log("editsMap has "&editsList.Size&" entries")
End Sub
Sub CreateListItem(index As Int,Text As String, Width As Int, Height As Int) As Panel
Dim p As Panel
p.Initialize("")
p.Color = Colors.Black
Dim b As Button
b.Initialize("button") 'all buttons click events will be handled with Sub Button_Click
b.Tag = index
b.Text = Text
Dim edt As EditText
edt.Initialize("edit")
edt.Text = index
edt.Tag = "#"&index
editsList.Add(edt)
p.AddView(edt, 10dip, 2dip, 150dip, Height - 4dip) 'view #1
p.AddView(b, 160dip, 2dip, 100dip, Height - 4dip) 'view #2
Return p
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub clv_ItemClick (Index As Int, Value As Object)
End Sub
Sub button_Click
Dim b As Button = Sender
Log("Button "&b.Tag&" clicked...")
End Sub
Sub btncheck_Click
For i = 0 To editsList.Size-1
Dim Payment As EditText = editsList.Get(i)
If IsNumber(Payment.Text) = False OR Payment.Text < 0 Then
Log("Edit # "&Payment.Tag&":Please use only positive numbers and up to one decimal.")
End If
Next
End Sub