Back button : Quit

Monkey Targets Forums/Android/Back button : Quit

Zurrr(Posted 2013) [#1]
Version 72b.

Now press back button quit monkey app.

unable to code:
If (KeyHit(KEY_ESCAPE) or (KeyHit(KEY_BACKSPACE)
do....
endif

Last known good respond: Version 68c


therevills(Posted 2013) [#2]
Try "KEY_BACK" and/or "KEY_CLOSE".


Zurrr(Posted 2013) [#3]
Both not work. Still quitting.
I have to go back to Version 68c. No problem.


ElectricBoogaloo(Posted 2013) [#4]
I had the same issue.
What people here tell you is "Use KEY_BACK, that works!"
What people here fail to tell you is that KEY_BACK only works in KeyHit() not KeyDown(), which baffled me to death when I failed to get it working for smegging ages!

Public Global HitBack
Method OnUpdate()
HitBack=KeyHit(KEY_BACK) ' Stick this right up at the top of your OnUpdate!
end

Then quit on HitBack.


therevills(Posted 2013) [#5]
He was using keyhit in his code example... But it is good to be clear about it.


Zurrr(Posted 2013) [#6]
Not really about const KEY_???

Press a back button on android just quiting. on version 70f an above.

I make further test and found out that the back button quit app start from version 70f to 72b. Further ver not test. Last known good version is 68c to 70b.


marksibly(Posted 2013) [#7]
Ther are now OnBack and OnClose methods in the mojo App class - please refer to App class docs.


Xaron(Posted 2013) [#8]
Forget about all these key codes, ESC hit and so on. Just put this into your app:

Method OnBack:Int()
  'Handle that stuff here
End Method