How to create a Menu instance programmatically? i.e. inflate a Menu outside onCreateOptionsMenu
问题 I want to inflate a menu object outside onCreateOptionsMenu method (which means to create/show the menu when the user doesn't press the button), so I need to create a menu instance to pass it to the inflate method. Here is an example of what I am trying to achieve: Menu menu = // How to create an instance !? new MenuInflater(context).inflate(R.menu.my_menu, menu) Menu is an interface, so I need to know which class is implementing it. I did browse Android code to get any hint on how a Menu