Not exactly, the key was the line, hold them in an external list.
Take a read of this for pointers.
Custom views are designed to be added with the designer. It is however very simple to create a layout file with the custom view and load it multiple times. Tip: remove the call to AutoScaleAll from the designer script. Complete example: Sub Globals Private B4XSwitch1 As B4XSwitch End...
www.b4x.com
The key thing to remember is that if you load a layout multiple times, the variables only point to the last instance created, which is why you need to create a list of them on creation.