Android Question xCustomListView

Johan Schoeman

Expert
Licensed User
Longtime User
Please advise

How many items can at maximum be added to a xCustomListView before it will generate the following error:

xCustomListView Error:
java.lang.RuntimeException: java.lang.RuntimeException: Object should first be initialized (List).

If I add less items then it seems to run without a problem. Not using lazy loading. Just a hard xCustomListView. 50 seems to be OK. Somewhere between 50 and 300 it causes the above error. Have not fiddled around to see what is the max I can push it to. Maybe someone has done this before and established the max....?

Rgds

JS
 

Johan Schoeman

Expert
Licensed User
Longtime User
That depends on your phone, as well as the size and complexity of your items.
That is also what I have sort of seen. Not too much of an issue as I can split it into more than one app and each handling the appropriate section.
 
Last edited:
Upvote 0

b4x-de

Active Member
Licensed User
Longtime User
Are you trying to access a view within a ListItem's panel? Let's say your item panel, pnlCustomer, has a label called lblFirstName. In that case, you cannot always safely access it through the member variable you declared in Class_Globals - even if looks correct "Private lblFirstName As Label."

This member variable may not (yet) point to the corresponding view in the ListItem's panel. It is better to access it via pnlCustomer.GetView(x) to ensure you are actually addressing the correct label.
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
Are you trying to access a view within a ListItem's panel? Let's say your item panel, pnlCustomer, has a label called lblFirstName. In that case, you cannot always safely access it through the member variable you declared in Class_Globals - even if looks correct "Private lblFirstName As Label."

This member variable may not (yet) point to the corresponding view in the ListItem's panel. It is better to access it via pnlCustomer.GetView(x) to ensure you are actually addressing the correct label.
I am doing it via GetView and that is all working and addressing the correct label. I will sometime this weekend add more than usual items to the txt file that the list is populated from and see what is the limit I can reach before the error occurs.
 
Upvote 0

Filippo

Expert
Licensed User
Longtime User
I am doing it via GetView and that is all working and addressing the correct label. I will sometime this weekend add more than usual items to the txt file that the list is populated from and see what is the limit I can reach before the error occurs.
If I were you, I wouldn't try something like that, because every smartphone reacts differently.
Just do it the way Erel suggested—that's the safest option.

With lazy loading (and especially PreoptimizedCLV) you can add hundreds of thousands of items. Without it, you can add hundreds+ items. Mostly depending on the layout of each item.
 
Upvote 0
Top