Search code examples
androidsubmenu

android onOptionsMenuClosed not being called for submenu


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?


Solution

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