As Android doesn’t support icons in context menus, I decided to replace the native ActionBar More menu item with my own custom item. The problem is that it doesn’t listen for the Menu hardware key presses. Is there any way I can implement this behavior? Actually the problem is to find a way to activate an item in ActionBar by pressing a key. Thanks in advance.
As Android doesn’t support icons in context menus, I decided to replace the native
Share
To display your menu (which is an ActionBar item as well) on a hardware menu button click, you can do this (you need to keep a reference to your Menu in the OnCreateOptionsMenu callback):