I have a button that opens a menu in our level,
In implementing the Android onKeyEvent I also
want to be able to open that menu if the user presses
the actual device menu button.
However, I need a way so that this doesn’t “spam” the device button
if the user hits it on the device more than once.
what can be added to the onKeyEvent code for such a thing?
example:
[lua]local function onKeyEvent( event )
local returnValue = true
if (event.phase==“up” and event.keyName==“menu”) then
timer.performWithDelay(100,openMenu,1)
end
return returnValue
end
– Add the key callback
Runtime:addEventListener( “key”, onKeyEvent )[/lua] [import]uid: 58922 topic_id: 17533 reply_id: 317533[/import]