I need a small project to better understand the issue.
I'll add a small example project, but I think I understand the problem and will try to explain it, so perhaps it will be useful to others as well (if things are as I'm about to write; you,
@Erel, will be more precise and use more precise terms).
Example.
Suppose you create a CustomListView (CLV for short) to which you want to add N items containing only a Label and an EditText (better a B4XFloatTextField, but it's an example).
You create a function (a Sub) that returns a B4XView (Pane(L)) in which you create, or load from a file, the Label and EditText; you also set their properties within that function.
Now, although the two Views are declared at the module level and not in the function - there are no local variables in B4X - you will have N copies of those Views in the CLV, each with its properties set to different values. In the Sub-Function, you will have a "
current" Label and EditText at each call.
This is definitely unusual behavior, although it works. It's not a bug; it's the way this thing works.
My mistake was trying to access a View of a CLV from within a Sub X, obviously without declaring it - the View I obtained by selecting an item from the CLV - rather than passing the View to Sub X, as if that View were
the current one for the entire class.