I have this code ,which I want to show the message when the user press the back button (keycode_back):
but I get this error:
What could be the problem?
Thanks in advance for any tip.
B4X:
Sub Activity_KeyPress (KeyCode As Int) As ResumableSub
If KeyCode = KeyCodes.KEYCODE_BACK Then
Msgbox2Async("Do you need to click in the button!","Interruped", "Continue", "Cancel", "", Null, True)
Wait For Msgbox_Result (Result As Int)
If Result <> DialogResponse.POSITIVE Then
Return True
End If
Activity.Finish
Return True
End If
Return False
End Sub
B4X:
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
main$HandleKeyDelayedrunDirectly (java line: 230)
java.lang.ClassCastException: anywheresoftware.b4a.keywords.Common$ResumableSubWrapper cannot be cast to java.lang.Boolean
at b4a.example.animate1.main$HandleKeyDelayed.runDirectly(main.java:230)
at b4a.example.animate1.main$HandleKeyDelayed.run(main.java:227)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Thanks in advance for any tip.