tags:

views:

457

answers:

2

Hi,

Can you please tell me the difference between context menu and option menu in android? When I click the menu button on the emulator, is that option menu? or context menu? And how to invoke the other menu (not trigger by the menu button)?

Thank you.

+5  A: 

When I click the menu button on the emulator, is that option menu?

Yes.

And how to invoke the other menu (not trigger by the menu button)?

By long-tapping on whatever widget (if any) has a context menu.

CommonsWare
What do you mean by "By long-tapping on whatever widget (if any) has a context menu."?I have a ListActivity with a ListView. In my ListActivity, I call 'registerForContextMenu(lv);' but I never get break in my 'onCreateContextMenu' or 'onContextItemSelected'I try click on ListView but nothing happens.
hap497
A long-tap is holding your finger down on the screen for 1-2 seconds. In the emulator, it is holding the mouse button down for 1-2 seconds. Note that for a ListView you might have to long-tap on an item in the list, rather than any blank space at the bottom of the list (if any).
CommonsWare
+3  A: 

The page on UI Guidelines and Menu Design in the Android documentation gives a good explaination of each of the types of menus.

Two line summary:
Options Menu - the menu you see when pressing the 'Menu' button
Context Menu - the menu shown when you press and hold an item.

Rachel