Duplicate: static options menu
Hi everyone,
I know how to create a menu in my application with an icon and text
I would like to know if it is possible to create a global menu which would be accessible from all activities?
Not really. Since you didn't like the inheritance solution, the only alternative is to consolidate the menu creation and handling code in one place (e.g., static methods). You would still need to implement the callbacks on each activity (e.g., onHandleOptionsMenu()
) and route them to the static common implementation.