Question

I want to be able to automatically unpause my app when the user exits from the options menu. (unless, of course, they have selected pause...)

Handling it onOptionsMenuClosed works fine for the top level menu but is not called for a submenu. The higher level onPanelClosed does not appear to be called either.

I can detect when they enter the menu and if they make a selection but not if they just hit the menu button to exit.

I could rewrite the whole submenu to use a dialog but I'd rather not if it can be avoided.

Does anyone have any suggestions?

Was it helpful?

Solution

You can override onKeyDown and implement a menu yourself when the menu button is detected.

OTHER TIPS

You could override the onkeydown , set a flag to check if the menu is shown or not do you thing then return super.onKeyDown(keyCode, event); .

You could check if menu if on screen on every keydown.Keep in mind that other buttons (Back , search and home and touch on other part of the screen closes the menu.) .With other buttons you may do handle them but home botton and finger tap cannot be override.

If i was you i whould forget the @override on onkeydown option for that purpose

But you can have 6 menu buttons the 6th called "More" and that could create a custom dialog with more options that you can handle

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top