I want to assure that an activity is destroyed by pressing the BACK key. I used the following code:
But I get the following error:
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
at Junior.Ranger.natura$HandleKeyDelayed.runDirectly(natura.java:228)
at Junior.Ranger.natura$HandleKeyDelayed.run(natura.java:225)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5255)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
What is wrong?
B4X:
Sub Activity_KeyPress (KeyCode As Int)
If KeyCode = KeyCodes.KEYCODE_BACK Then
Activity.Finish
End If
End Sub
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
at Junior.Ranger.natura$HandleKeyDelayed.runDirectly(natura.java:228)
at Junior.Ranger.natura$HandleKeyDelayed.run(natura.java:225)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5255)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
What is wrong?