Sub Globals
Private Mainlist As CustomListView
end sub
Sub Activity_Create(FirstTime As Boolean)
Dim cursor1 As Cursor
Activity.LoadLayout("Layout1")
cursor1 = Main.SQLDB.ExecQuery("SELECT DISTINCT ARTGROEP.GRPNR, ARTGROEP.GRPOMS FROM ARTGROEP ORDER BY ID ASC;")
If (cursor1.RowCount > 0) Then
cursor1.Position = 0
For i = 0 To cursor1.RowCount - 1
cursor1.Position = i
MainList.Add(MainItem(cursor1.GetString("GRPOMS").Trim),cursor1.GetString("GRPNR").trim)
Next
End If
cursor1.Close
End Sub
Sub MainItem (txt As String) As B4XView
Dim p As B4XView = xui.CreatePanel("Panel")
Dim TargetDir As String
If File.ExternalWritable Then TargetDir = File.DirDefaultExternal Else TargetDir = File.DirInternal
p.SetLayoutAnimated(0, 0, 0,MainList.AsView.Width,MainList.AsView.Height/3)
p.LoadLayout("item")
Label0.Color = Colors.White ''Transparent
Label0.TextColor = Colors.black
Label0.TextSize = 18
Label0.Top = Imageview0.Height - 5%y
Label0.Left = 2%x
Label0.Width = 15%x
Label0.Height = 4%y
If (File.Exists(TargetDir & "/PICTURES/GROEP",txt & ".JPG") = True) Then
Imageview0.Bitmap = xui.LoadBitmapResize(TargetDir & "/PICTURES/GROEP", txt & ".JPG",Imageview0.Width,Imageview0.Height,True)
End If
Label0.Text = txt
Return p
End Sub
Sub MainList_ItemClick (Index As Int, Value As Object)
'' here i go to another screen.
'' showing picture and changing text
'' after that going back to customlist, not rebuilding but only
'' corresponding label0.text has to be changed.
end sub