Android Question [RESOLVED] [B4X] B4XPages without effect Refresh

MarcoRome

Expert
Licensed User
Longtime User
Hi Erel, all.
I have 2 Activity B4XPages and this code.
B4XMainPage:

B4X:
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    'load the layout to Root
    'load the layout to Root
    Root.LoadLayout("lay_main")
    Page2.Initialize
    'B4XPages.AddPage("Page2", Page2)
    B4XPages.AddPageAndCreate("Page2", Page2)
    'Page2 = B4XPages.GetPage("Page2")
 
End Sub

Sub B4XPage_Appear
    Log("sono qui")
    WobbleMenu1.SetCurrentTab(1)
End Sub

'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.

Sub WobbleMenu1_Tab2Click
    'B4XPages.ShowPageAndRemovePreviousPages("Page2")
    B4XPages.ShowPage("Page2")
End Sub

B4XPage2:

B4X:
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    'load the layout to Root
    Root.LoadLayout("lay_page2")
 
End Sub


Sub WobbleMenu1_Tab1Click
    'B4XPages.ShowPageAndRemovePreviousPages("MainPage")
    B4XPages.ShowPage("MainPage")
End Sub

Sub B4XPage_Appear
    Log("Appear Page2")
    WobbleMenu1.SetCurrentTab(2)
End Sub

Sub B4XPage_Disappear
    Log("Disappear Page2")
End Sub

in MainPage i have
B4X:
B4XPages.AddPageAndCreate("Page2", Page2)
So the page2 already create in this step and after we "play" only with B4XPages.ShowPage, but still i get the unwanted effect of the refresh
Anyway when i click in
B4X:
Sub WobbleMenu1_Tab2Click
    B4XPages.ShowPage("Page2")
End Sub
i have this "refresh" , where and how if the activity was recharged.
I also tried to eliminate Animation Duration = 0 in Design but dont change nothying.

Where i wrong ? Is it possible to have a "linear" effect (as at the end of the movie) without having the refresh.

Thank you
Marco

20200612_152107.gif
 

Attachments

  • B4XPage-Test.zip
    24.1 KB · Views: 309
Last edited:

sentechnologies

Member
Licensed User
B4XPage-Test ap is not working, it crashes immediatly when open

Error:
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
wobblemenu_designercreateview (java line: 471)
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
    at anywheresoftware.b4a.objects.B4XViewWrapper$XUI.PaintOrColorToColor(B4XViewWrapper.java:711)
    at b4a.example.wobblemenu._designercreateview(wobblemenu.java:471)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
    at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:67)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
    at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(PanelWrapper.java:134)
    at anywheresoftware.b4a.objects.B4XViewWrapper.LoadLayout(B4XViewWrapper.java:311)
    at b4a.example.b4xmainpage._b4xpage_created(b4xmainpage.java:50)
    at b4a.example.b4xmainpage.callSub(b4xmainpage.java:87)
    at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1066)
    at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:1037)
    at b4a.example.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:498)
    at b4a.example.b4xpagesmanager._showpage(b4xpagesmanager.java:800)
    at b4a.example.b4xpagesmanager._addpage(b4xpagesmanager.java:198)
    at b4a.example.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:205)
    at b4a.example.b4xpagesmanager._initialize(b4xpagesmanager.java:681)
    at b4a.example.main._activity_create(main.java:354)
    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:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:237)
    at android.app.ActivityThread.main(ActivityThread.java:7860)
    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:1075)
 
Upvote 0
Top