Hi,
I have tried to implement back button on Android to exit when the application is at the starting scene. So by clicking back button will eventually exit the app. However, I am getting an error popping “Unfortunately, your app has stopped” instead of closing peacefully.
I did a logcat and see the following.
I/Corona (20494): Runtime error I/Corona (20494): no Java state I/Corona (20494): stack traceback: I/Corona (20494): [C]: in function 'request' I/Corona (20494): ?: in function '?' I/Corona (20494): ?: in function 'func' I/Corona (20494): /Users/jenkins/slaveroot/workspace/Templates/label/andro id/platform/resources/init.lua:241: in function \</Users/jenkins/slaveroot/worksp ace/Templates/label/android/platform/resources/init.lua:221\>
What I did was to start with an eventListener for the back button
Runtime:addEventListener( "key", onKeyBlankEvent )
Followed by calling the request exit
local function onKeyBlankEvent(event) local phase = event.phase local keyName = event.keyName if ( "back" == keyName and phase == "up" ) then native.requestExit() return true else return false end end
Anything I did wrong here to get the error? I even tried sending the app to another scene with just native.requestExit() but upon exit, I still get the same error. I’m on build 2015.2646
Thanks in advanced.