This question refer to this discussion:
https://www.b4x.com/android/forum/t...-creation-with-code-not-with-designer.117247/
In the linked discussion has been given the solution how to add a CustomView by code:
making a dedicated layout with the CustomView and loading the layout on a panel.
But the CustomView on the layout will have it's own name.
Loading the same layout 2 times, in the need to add 2 times (or more) the same CustomView, will create the problem that the working CustomView will always be the last added one.
There is a way to solve this?
Looking in the Klaus's Booklet about CustomViews we found that adding a small Sub into the CustomView would make it possible to add it by code without the trick of the layout.
Here it is
And the call from code (for B4A, B4i)
Adding that Sub to CustomView (CustomListView in this case) would make it possible to add it in that way?
Or did I misunderstood something?
In the case can we get it on next CustomListView update?
Should this thing be taken into consideration by CustomView Developers?
https://www.b4x.com/android/forum/t...-creation-with-code-not-with-designer.117247/
In the linked discussion has been given the solution how to add a CustomView by code:
making a dedicated layout with the CustomView and loading the layout on a panel.
But the CustomView on the layout will have it's own name.
Loading the same layout 2 times, in the need to add 2 times (or more) the same CustomView, will create the problem that the working CustomView will always be the last added one.
There is a way to solve this?
Looking in the Klaus's Booklet about CustomViews we found that adding a small Sub into the CustomView would make it possible to add it by code without the trick of the layout.
Here it is
B4X:
Public Sub AddToParent(Parent As Activity, Left As Int, Top As Int, Width As Int, Height As Int)
mBase.Initialize("mBase")
Parent.AddView(mBase, Left, Top, Width, Height)
End Sub
B4X:
Private clsTest2 As ClsCustomView
clsTest2.Initialize(Me, "clsTest2")
clsTest2.AddToParent(MyPanel, 10dip, 10dip, 200dip, 50dip)
Or did I misunderstood something?
In the case can we get it on next CustomListView update?
Should this thing be taken into consideration by CustomView Developers?