tags:

views:

23

answers:

1

Sharing an Options Menu between Activity and MapActivity. Is this possible?

I have an Options Menu shared between multiple Activities but now I need that menu in a MapActivity.

+1  A: 

Define the menu in XML. Put the smarts to load that XML in a static method, then call that method from onCreateOptionsMenu() in your various classes. Put the smarts for onOptionsItemSelected() in another static method, and call that method from onOptionsItemSelected() in your various classes.

CommonsWare
Many thanks. I did try that but the onOptionsItemSelected() contains references to non-statics. I did try to functionalise further with static methods but to no avail.Did I give up to early?
sugarynugs
@sugarynugs: I successfully implemented this on a consulting project. It worked fine. Just pass the `Activity` to the static method.
CommonsWare
Many thanks. ;D
sugarynugs