gammaraptor
gammaraptor

Reputation: 1886

Android Multiple Options Menu

I would like to have two options menus in Android that are triggered using buttons inside the activity. Is this possible? If so, how would I go about doing so?

Upvotes: 0

Views: 1029

Answers (1)

Brian
Brian

Reputation: 8085

I'm not sure if there's a direct way of doing this, but there is kind of a work around. You could create the method that launches the menu the regular way, by declaring public boolean onCreateOptionsMenu(Menu menu) and/or public boolean onPrepareOptionsMenu(Menu menu) but have two different "modes". From your button, you can programmatically open the options menu by simply calling openOptionsMenu(). Just before you open the menu, just set the "mode" to whatever the button's menu should be in. I hope you understand what I mean, let me know if you need clarifying!

Upvotes: 1

Related Questions