Android Question Show Next page in B4X Pages

Hi. I am new to B4X Pages. I created a new project using B4X Pages and I added a standard page named "Sample". I have to open page 2 immediately after B4XMainPage is displayed. But It Shows An Error. Here is My Code

B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
'    Root = Root1
'    Root.LoadLayout("MainPage")
    page1.Initialize
    B4XPages.AddPage("page1", page1)
    B4XPages.ShowPage("page1")
End Sub
 
Last edited:
Hi. I am new to B4X Pages. I created a new project using B4X Pages and I added a standard page named "Sample". I have to open page 2 immediately after B4XMainPage is displayed. But It Shows An Error. Here is My Code

B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
'    Root = Root1
'    Root.LoadLayout("MainPage")
    page1.Initialize
    B4XPages.AddPage("page1", page1)
    B4XPages.ShowPage("page1")
End Sub
B4X:
Public page1 As sample
 
Upvote 0
Not like this. Right click - copy to clipboard and post it here.
--------- beginning of crash
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
sample_b4xpage_created (java line: 42)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(PanelWrapper.java:134)
at anywheresoftware.b4a.objects.B4XViewWrapper.LoadLayout(B4XViewWrapper.java:312)
at b4a.example.sample._b4xpage_created(sample.java:42)
at b4a.example.sample.callSub(sample.java:70)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1069)
at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:1040)
at b4a.example.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:524)
at b4a.example.b4xpagesmanager._showpage(b4xpagesmanager.java:861)
at b4a.example.b4xpages._showpage(b4xpages.java:122)
at b4a.example.b4xmainpage._b4xpage_created(b4xmainpage.java:42)
at b4a.example.b4xmainpage.callSub(b4xmainpage.java:66)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1069)
at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:1040)
at b4a.example.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:524)
at b4a.example.b4xpagesmanager._showpage(b4xpagesmanager.java:861)
at b4a.example.b4xpagesmanager._addpage(b4xpagesmanager.java:201)
at b4a.example.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:208)
at b4a.example.b4xpagesmanager._initialize(b4xpagesmanager.java:712)
at b4a.example.main._activity_create(main.java:367)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
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:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6692)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
... 31 more
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:216)
at android.content.res.Resources.getDimensionPixelSize(Resources.java:727)
at main.java.org.angmarch.views.NiceSpinner.init(NiceSpinner.java:125)
at main.java.org.angmarch.views.NiceSpinner.<init>(NiceSpinner.java:70)
at nicespinnerwrapper.niceSpinnerWrapper._initialize(niceSpinnerWrapper.java:63)
... 34 more
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
sample_b4xpage_created (java line: 42)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(PanelWrapper.java:134)
at anywheresoftware.b4a.objects.B4XViewWrapper.LoadLayout(B4XViewWrapper.java:312)
at b4a.example.sample._b4xpage_created(sample.java:42)
at b4a.example.sample.callSub(sample.java:70)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1069)
at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:1040)
at b4a.example.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:524)
at b4a.example.b4xpagesmanager._showpage(b4xpagesmanager.java:861)
at b4a.example.b4xpages._showpage(b4xpages.java:122)
at b4a.example.b4xmainpage._b4xpage_created(b4xmainpage.java:42)
at b4a.example.b4xmainpage.callSub(b4xmainpage.java:66)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1069)
at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:1040)
at b4a.example.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:524)
at b4a.example.b4xpagesmanager._showpage(b4xpagesmanager.java:861)
at b4a.example.b4xpagesmanager._addpage(b4xpagesmanager.java:201)
at b4a.example.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:208)
at b4a.example.b4xpagesmanager._initialize(b4xpagesmanager.java:712)
at b4a.example.main._activity_create(main.java:367)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
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:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6692)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
... 31 more
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:216)
at android.content.res.Resources.getDimensionPixelSize(Resources.java:727)
at main.java.org.angmarch.views.NiceSpinner.init(NiceSpinner.java:125)
at main.java.org.angmarch.views.NiceSpinner.<init>(NiceSpinner.java:70)
at nicespinnerwrapper.niceSpinnerWrapper._initialize(niceSpinnerWrapper.java:63)
... 34 more
 
Upvote 0
Top