Hi,
for using the android back button I used this code in the B4XMainPage:
and this default code in Main :
This error occured :
Error occurred on line: 7208 (B4XPagesDelegator)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.keywords.Common.CallSubDebug(Common.java:1050)
at sama.sport.b4xpagesmanager$ResumableSub_HandleCloseRequest.resume(b4xpagesmanager.java:843)
at sama.sport.b4xpagesmanager._handlecloserequest(b4xpagesmanager.java:810)
at sama.sport.b4xpagesmanager._activity_keypress(b4xpagesmanager.java:565)
at sama.sport.b4xpagesdelegator._activity_keypress(b4xpagesdelegator.java:51)
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 sama.sport.main$HandleKeyDelayed.runDirectly(main.java:231)
at sama.sport.main$HandleKeyDelayed.run(main.java:228)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:216)
at android.app.ActivityThread.main(ActivityThread.java:7266)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:336)
at anywheresoftware.b4a.debug.Debug.CallSubNew(Debug.java:282)
... 21 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:318)
... 22 more
Caused by: java.lang.ClassCastException: anywheresoftware.b4a.keywords.Common$ResumableSubWrapper cannot be cast to java.lang.String
at sama.sport.b4xmainpage._b4xpage_closerequest(b4xmainpage.java:5824)
... 24 more
It is unbelievable I have already wrote 9000 lines code for his app and published it to appstore and still cant use the android back button ??
for using the android back button I used this code in the B4XMainPage:
B4X:
private Sub B4XPage_CloseRequest As ResumableSub
Dim sf As Object = xui.Msgbox2Async("Close?", "Title", "Yes", "Cancel", "No", Null)
Wait For (sf) Msgbox_Result (Result As Int)
If Result = xui.DialogResponse_Positive Then
Return True
End If
End Sub
and this default code in Main :
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean
Return B4XPages.Delegate.Activity_KeyPress(KeyCode)
End Sub
This error occured :
Error occurred on line: 7208 (B4XPagesDelegator)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.keywords.Common.CallSubDebug(Common.java:1050)
at sama.sport.b4xpagesmanager$ResumableSub_HandleCloseRequest.resume(b4xpagesmanager.java:843)
at sama.sport.b4xpagesmanager._handlecloserequest(b4xpagesmanager.java:810)
at sama.sport.b4xpagesmanager._activity_keypress(b4xpagesmanager.java:565)
at sama.sport.b4xpagesdelegator._activity_keypress(b4xpagesdelegator.java:51)
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 sama.sport.main$HandleKeyDelayed.runDirectly(main.java:231)
at sama.sport.main$HandleKeyDelayed.run(main.java:228)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:216)
at android.app.ActivityThread.main(ActivityThread.java:7266)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:336)
at anywheresoftware.b4a.debug.Debug.CallSubNew(Debug.java:282)
... 21 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:318)
... 22 more
Caused by: java.lang.ClassCastException: anywheresoftware.b4a.keywords.Common$ResumableSubWrapper cannot be cast to java.lang.String
at sama.sport.b4xmainpage._b4xpage_closerequest(b4xmainpage.java:5824)
... 24 more
It is unbelievable I have already wrote 9000 lines code for his app and published it to appstore and still cant use the android back button ??