-1

I want to do a button that when I click it does the same what the menu button of the telephone would do.

I know for example that if I use onBackPressed(); it does the same that the back button of the telephone would do.

Anybody knows how to do that for the menu button?

Thank you

bardiir
  • 14,556
  • 9
  • 41
  • 66
user1096087
  • 33
  • 1
  • 5

2 Answers2

0

I found a link suggesting that you do this:

@Override
public boolean onKeyDown(int keycode, KeyEvent event ) {
 if(keycode == KeyEvent.KEYCODE_MENU){
  //WHATEVER YOU'D LIKE TO DO
 }
 return super.onKeyDown(keycode,event);  
}

Is this what you are looking for?

Source of the code

Rupal
  • 482
  • 4
  • 8
  • 14
0

If you are trying to open the app's option menu, as the Menu button does, take a look here

Android Option Menu on Button click

Community
  • 1
  • 1
user1076637
  • 768
  • 5
  • 15