I have a problem with double registration of the DDD class.
I register it on the main page and use it.
The problem is that the second page is an independent customview, so it should have its own registration, where I need the DDD class. If I register DDD in the customview module, and then call in main page:
an error appears:
Is there any solution?
I register it on the main page and use it.
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
dd.Initialize
xui.RegisterDesignerClass(dd)
Root = Root1
Root.LoadLayout("MainPage")
Dim pnl1 As Panel = myView1.AddLayout("L1", 10dip, 10dip, xui.Color_Cyan) '<----- create and get panel from customview
pnl1.Color = xui.Color_Green
dd.GetViewByName(Root,"Button1").Text = "myButton" '<----- OK
dd.GetViewByName(pnl1, "Label1").Text = "Title1" '<----- get error
End Sub
B4X:
dd.GetViewByName(pnl1, "Label1").Text = "Title1"
B4X:
Error occurred on line: 256 (DDD)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:1140)
at b4a.example.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:1068)
at b4a.example.b4xpagesmanager._showpage(b4xpagesmanager.java:425)
at b4a.example.b4xpagesmanager._addpage(b4xpagesmanager.java:245)
at b4a.example.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:259)
at b4a.example.b4xpagesmanager._initialize(b4xpagesmanager.java:165)
at b4a.example.main._activity_create(main.java:415)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at b4a.example.main.afterFirstLayout(main.java:105)
at b4a.example.main.access$000(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7825)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:336)
at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:285)
... 24 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:318)
... 25 more
Caused by: java.lang.RuntimeException: Object should first be initialized (B4XView).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:67)
at anywheresoftware.b4a.objects.B4XViewWrapper.asLabelWrapper(B4XViewWrapper.java:213)
at anywheresoftware.b4a.objects.B4XViewWrapper.setText(B4XViewWrapper.java:229)
at b4a.example.b4xmainpage._b4xpage_created(b4xmainpage.java:77)
... 27 more
** Activity (main) Resume **
Is there any solution?