Sergey_New Well-Known Member Licensed User Longtime User Oct 5, 2020 #1 Press the Up button to close the current page: B4X: Copy Sub Up_Click B4XPages.ShowPageAndRemovePreviousPages("MainPage") End Sub How to do this by pressing the back button of the device?
Press the Up button to close the current page: B4X: Copy Sub Up_Click B4XPages.ShowPageAndRemovePreviousPages("MainPage") End Sub How to do this by pressing the back button of the device?
Geezer Active Member Licensed User Longtime User Oct 5, 2020 #2 B4X: Copy 'Return True to close, False to cancel Private Sub B4XPage_CloseRequest As ResumableSub B4XPages.ShowPageAndRemovePreviousPages( "MainPage" ) Return False End Sub Upvote 0
B4X: Copy 'Return True to close, False to cancel Private Sub B4XPage_CloseRequest As ResumableSub B4XPages.ShowPageAndRemovePreviousPages( "MainPage" ) Return False End Sub
Sergey_New Well-Known Member Licensed User Longtime User Oct 5, 2020 #3 Geezer, error: Spoiler: Error Error occurred on line: 504 (B4XPagesManager) java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invoke(Native Method) at anywheresoftware.b4a.keywords.Common.CallSubDebug(Common.java:1050) at b4a.example.b4xpagesmanager$ResumableSub_HandleCloseRequest.resume(b4xpagesmanager.java:811) at b4a.example.b4xpagesmanager._handlecloserequest(b4xpagesmanager.java:781) at b4a.example.b4xpagesmanager._activity_keypress(b4xpagesmanager.java:539) at b4a.example.b4xpagesdelegator._activity_keypress(b4xpagesdelegator.java:63) at b4a.example.main._activity_keypress(main.java:424) 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:144) at b4a.example.main$HandleKeyDelayed.runDirectly(main.java:231) at b4a.example.main$HandleKeyDelayed.run(main.java:228) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Caused by: java.lang.RuntimeException: java.lang.Exception: Sub B4XPage_CloseRequest was not found. at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:336) at anywheresoftware.b4a.debug.Debug.CallSubNew(Debug.java:282) ... 22 more Caused by: java.lang.Exception: Sub B4XPage_CloseRequest was not found. at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:326) ... 23 more ** Activity (main) Pause event (activity is not paused). ** Upvote 0
Geezer, error: Spoiler: Error Error occurred on line: 504 (B4XPagesManager) java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invoke(Native Method) at anywheresoftware.b4a.keywords.Common.CallSubDebug(Common.java:1050) at b4a.example.b4xpagesmanager$ResumableSub_HandleCloseRequest.resume(b4xpagesmanager.java:811) at b4a.example.b4xpagesmanager._handlecloserequest(b4xpagesmanager.java:781) at b4a.example.b4xpagesmanager._activity_keypress(b4xpagesmanager.java:539) at b4a.example.b4xpagesdelegator._activity_keypress(b4xpagesdelegator.java:63) at b4a.example.main._activity_keypress(main.java:424) 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:144) at b4a.example.main$HandleKeyDelayed.runDirectly(main.java:231) at b4a.example.main$HandleKeyDelayed.run(main.java:228) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Caused by: java.lang.RuntimeException: java.lang.Exception: Sub B4XPage_CloseRequest was not found. at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:336) at anywheresoftware.b4a.debug.Debug.CallSubNew(Debug.java:282) ... 22 more Caused by: java.lang.Exception: Sub B4XPage_CloseRequest was not found. at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:326) ... 23 more ** Activity (main) Pause event (activity is not paused). **
Sergey_New Well-Known Member Licensed User Longtime User Oct 5, 2020 #4 Removed spaces in (" MainPage ") and it works! Thanks! Upvote 0