Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
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.
Dim clv1 As CustomListView
Dim Panel1 As Panel
Dim listOfContacts As List
Dim Contatti As Contacts
Dim Contatto As Contact
Dim nome As String
Dim iv As ImageView
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")
clv1.Initialize(Me, "clv1")
Panel1.AddView(clv1.AsView, 0, 0, Panel1.Width, Panel1.Height)
clv1.DefaultTextBackgroundColor = Colors.DarkGray
listOfContacts = Contatti.GetAll
For i = 0 To listOfContacts.Size - 1
Contatto = listOfContacts.Get(i)
clv1.Add(CreateListItem("Item #" & i, clv1.AsView.Width, 150dip), 150dip, "Item #" & i )
Next
End Sub
Sub CreateListItem(Text As String, Width As Int, Height As Int)As Panel
Dim p As Panel
p.Initialize("")
p.Color = Colors.Black
Dim photo As Bitmap
photo = Contatto.GetPhoto
iv.Initialize("")
If photo<>Null Then
iv.Bitmap=photo
iv.SetLayout(0,0,100dip,100dip)
End If
Dim b As Button
b.Initialize("button") 'all buttons click events will be handled with Sub Button_Click
Dim chk As CheckBox
chk.Initialize("")
Dim lbl As Label
lbl.Initialize("")
lbl.Gravity = Bit.OR(Gravity.CENTER_VERTICAL, Gravity.LEFT)
lbl.Text = Text
lbl.TextSize = 16
lbl.TextColor = Colors.White
b.Text = "Click"
p.AddView(iv, 100, 2dip, 150dip, Height - 4dip) 'view #0
'p.AddView(b, 155dip, 2dip, 110dip, Height - 4dip) 'view #1
'p.AddView(chk, 280dip, 2dip, 50dip, Height - 4dip) 'view #2
Return p
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub