Sam Voss
Android Enthusiast
Hey everyone, I'd like to know, is it possible to have the same menu run throughout an entire application? I'd like to just have one menu, as its all I need.
Okay, so I'm sure someones going to bring this up, (see below) and if you do, before you just send me a link, explain to me how to do this, because you cannot extend more than once class in java, so please, how do you extend to Activity and to my other class?
Okay, so I'm sure someones going to bring this up, (see below) and if you do, before you just send me a link, explain to me how to do this, because you cannot extend more than once class in java, so please, how do you extend to Activity and to my other class?
Code:
Tip: If your application contains multiple activities and some of them provide the same Options Menu, consider creating an Activity that implements nothing except the onCreateOptionsMenu() and onOptionsItemSelected() methods. [U][B][I]Then extend this class for each Activity that should share the same Options Menu.[/I][/B][/U] This way, you have to manage only one set of code for handling menu actions and each decendent class inherits the menu behaviors.
If you want to add menu items to one of your decendent activities, override onCreateOptionsMenu() in that Activity. Call super.onCreateOptionsMenu(menu) so the original menu items are created, then add new menu items with menu.add(). You can also override the super class's behavior for individual menu items