You may have a look at the
B4X Custom Views Booklet.
Thanks,
I went through it and various examples and they are running fine when I compiled them.
I still didn't manage to make mine works.
I stripped down my code to the minimum.
Basically my custom view is now just loading a layout.
I tried with CustomView and CustomView XUI without success :-(
Stripped down code of my custom view:
Sub Class_Globals
Private mEventName As String 'ignore
Private mCallBack As Object 'ignore
Private mBase As Panel
Private Button1 As Button
End Sub
Public Sub Initialize (Callback As Object, EventName As String)
mEventName = EventName
mCallBack = Callback
End Sub
Public Sub DesignerCreateView (Base As Panel, Lbl As Label, Props As Map)
mBase = Base
mBase.LoadLayout("Basic")
End Sub
the Layout "Basic" only include one button since I wanted to test with the simplest case.
My Custom view Initialize and DesignerCreateView methods are called [I put breakpoints there]
But the call to LoadLayout fails with:
Error occurred on line: 56 (QRCodeSummaryView)
java.lang.RuntimeException: java.lang.ClassCastException: sg.com.idigo.pokeelite.b4xtable cannot be cast to android.widget.TextView
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(PanelWrapper.java:134)
...
And I can't understand where the "sg.com.idigo.pokeelite.b4xtable cannot be cast to android.widget.TextView" come from !
Note that I have a B4XTable in the main activity layout that include my custom view, but I can't see how they relate.
Any clues will be much then welcome !