Sub CustomListView1_VisibleRangeChanged (FirstIndex As Int, LastIndex As Int)
For Each i As Int In PCLV.VisibleRangeChanged(FirstIndex, LastIndex)
Dim item As CLVItem = CustomListView1.GetRawListItem(i)
Dim pnl As B4XView = xui.CreatePanel("")
item.Panel.AddView(pnl, 0, 0, item.Panel.Width, item.Panel.Height)
Dim data As MyImageData = item.Value
pnl.LoadLayout("item2")
Dim x As Int
For x = 0 To 3
If data.IndexOfFirstImage + x >= TotalNumberOfImages Then Exit 'VERY IMPORTANT in case # of pictures is not divisible
Dim s As String =l2.Get(x)
s=s.SubString2(0, s.LastIndexOf("."))
pnl.GetView(x).GetView(1).Text = s 'label text
pnl.GetView(x).Tag = data.IndexOfFirstImage + x 'inside the loop
MediaManager.SetMediaFromFile(pnl.GetView(x).GetView(0), File.DirAssets, l2.get(x),"image/png", Null) 'l2 is a list of the files
Next
Next
MediaManager.TrimMediaCache
End Sub