Title explains everything. I want to open a submenu in actionbar when clicking Hardware menu button
This is the code and it works fine first time i click menu. Every
Try this:
public boolean onCreateOptionsMenu(Menu menu)
{
super.onCreateOptionsMenu(menu);// <--- add this
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.options, menu);
mainMenu = menu;
return true;
}
//override this method instead of onKeyDown()....
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
super.onOptionsItemSelected(item);
int menuId = item.getItemId();
if(menuId == R.id.settings)
{
//do settings
}
//else if(menuId = ...) {....}
return true;
}