Android Question B4XPages and Back button

yiankos1

Well-Known Member
Licensed User
Longtime User
Hello,

I encounter strange behavior at my application. In some pages when I click back button everything works fine and this sub: Private Sub B4XPage_CloseRequest As ResumableSub is fired. Some pages does not fire this sub and throws me this error:
B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
TokenTime: 1
Notification granted
*** Receiver (httputils2service) Receive (first time) ***
Websocket connected!
*** Receiver (firebasemessaging) Receive (first time) ***
** Activity (main) Resume **
Error occurred on line: 540 (B4XPagesManager)
java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.keywords.Common.CallSubDebug(Common.java:1082)
    at com.wecreateapps.fitbook.b4xpagesmanager$ResumableSub_HandleCloseRequest.resume(b4xpagesmanager.java:857)
    at com.wecreateapps.fitbook.b4xpagesmanager._handlecloserequest(b4xpagesmanager.java:824)
    at com.wecreateapps.fitbook.b4xpagesmanager._activity_keypress(b4xpagesmanager.java:654)
    at com.wecreateapps.fitbook.b4xpagesdelegator._activity_keypress(b4xpagesdelegator.java:71)
    at com.wecreateapps.fitbook.main._activity_keypress(main.java:485)
    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 com.wecreateapps.fitbook.main$HandleKeyDelayed.runDirectly(main.java:231)
    at com.wecreateapps.fitbook.main$HandleKeyDelayed.run(main.java:228)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7918)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
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)
    ... 23 more
Caused by: java.lang.Exception: Sub B4XPage_CloseRequest was not found.
    at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:326)
    ... 24 more
** Activity (main) Pause event (activity is not paused). **
** Service (starter) Destroy (ignored)**
This happens only in Debug mode.

UPDATE:
Did not changed anything and back button working normal. Maybe a bug?
 
Last edited:

mangojack

Expert
Licensed User
Longtime User
This happens only in Debug mode.

I have encountered this error when adding _CloseRequest event sub to a new page , and immediately running Debug.

Running Tools / Clean Project , fixes this issue.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…