B4J Question index exceeds maxCellCount in listview

Didier9

Well-Known Member
Licensed User
Longtime User
I started getting this error (actually not an error but the listview display gets erratic and I get these warnings in the log window):

B4X:
Aug 13, 2025 4:00:13 PM javafx.scene.control.skin.VirtualFlow addTrailingCells
INFO: index exceeds maxCellCount. Check size calculations for class anywheresoftware.b4j.objects.ListViewWrapper$MyCallBack$1

repeated every time a new item gets added to the listview. Actually, I get both messages two or three times for each item added to the listview.
lvTest.png

It does not start immediately, it runs for a few seconds (exactly 289 messages).
I am using B4J v10.30 and jdk 19
I have created the minimum program necessary to show the problem. It's just a listview and a timer
I does the same in debug and release mode.

I have not seen anything recent about this but just in case, I updated everything that I could on this Dell Precision 3551 including the display drivers just yesterday to make sure that was not the issue.
It runs Windows 10 Pro and has an NVidia Quadro graphic chip.
That machine has 64GB of RAM, so that's probably not the issue...

If I remove the ScrollTo statement, there is no problem.

I use the same construct on other machines and so far I have not seen that problem. This machine used to run this code with no complaints. Not sure what I did to get this started...

TIA

Edit: I changed the timer from 20mS to 200mS and it started doing it after exactly 289 messages regardless of the timer setting, so it does not seem like time is a factor.
 

Attachments

  • lvTest.zip
    2.2 KB · Views: 17
Last edited:

Didier9

Well-Known Member
Licensed User
Longtime User
Thank you Erel!
Looking at the CustomListView, it may not be the best thing for my use case.
But the ListView was probably not a good choice either, regardless of that particular limitation. It was "convenient" :)
I resolved the issue by pruning the older records from the ListView when it gets too big.
I am not sure of the performance implications of doing that at a potentially fast rate (this example is timer driven, but I have no control on how fast data comes in in my application)
B4X:
Sub displayTimer_Tick
    Log( i )
    Do While ListView1.Items.Size > 250
        ListView1.Items.RemoveAt(0)
    Loop
    ListView1.items.add( "this is a test " & i )
    i = i+1
    ListView1.ScrollTo( ListView1.Items.Size - 1 )
End Sub
I will keep a separate simple list of the records for when I need to access an older record.
I normally don't need to be scrolling back very far on screen but I need programmatic access to all the data, which can be a lot!
 
Upvote 0
Top