Android Question PreoptimizedCLV lag issue

Hi everyone. I'm using PreoptimizedCLV to list-out products in customlistview. When I'm scrolling down I'm facing little bit lag as below,


Is it normal or not?

I've use below code,

B4X:
Sub Globals
    Private XUI As XUI
    Private PCLV As PreoptimizedCLV
    
    
    'product list iems
    Private Panel1 As B4XView
    Private img As B4XView
    Private lbl_description As B4XView
    Private lbl_title As B4XView
    Type TestData (title As String,description As String )
    
End Sub


B4X:
Sub add_list_items
    For x =1 To 100
           
        Dim td As TestData
        td.Initialize
        
        td.title="Product title " & x
        td.description="Product description " & x
        
        PCLV.AddItem(135dip, XUI.Color_White, td)

    Next
    PCLV.ShowScrollBar = True 'no fast scrolling
    PCLV.ExtraItems = 5
    PCLV.Commit
End Sub

B4X:
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 td As TestData=item.Value
        
        Dim pnl As B4XView = XUI.CreatePanel("")
        item.Panel.AddView(pnl, 0, 0, item.Panel.Width, 135dip)
        'Create the item layout
        pnl.LoadLayout("Item")
        lbl_title.Text=td.title
        lbl_description.Text=td.description
    Next
End Sub

If anyone know how to fix this, Please let me know. Thank you
 

Peter Simpson

Expert
Licensed User
Longtime User
Upvote 0
@Peter Simpson Thank you for your reply. I've tested this in release mode. If I integrate it with MySQL and load data from MySQL database,its not lagging. If I populate data just a loop its bit lagging. You can see it clearly in the last few minutes of the video. If you cant see the video, Please let me know. Thank you

 
Upvote 0
Top