Reputation: 3294
I want to add a button for settings to the options menu of my app. Do I have to do this for each Activity or can I set it globally once?
Upvotes: 0
Views: 729
Reputation: 116342
you can extend from Activity , put there your logic of the menu , and make all of your activities extend from the new class .
Upvotes: 2
Reputation: 915
You can @Override
public boolean onCreateOptionsMenu(Menu menu) {
menu= Aclass.options(menu);
return(super.onCreateOptionsMenu(menu));
}
in each activity, where Aclass.options(menu) a static returning method to add common options to the menu. Or, you can
Here is a good solution if you have dozens of Activities
Upvotes: 1