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?
Asked
Active
Viewed 723 times
0
-
extend an activity that has the functionality for settings – L7ColWinters Jun 05 '12 at 20:30
2 Answers
2
you can extend from Activity , put there your logic of the menu , and make all of your activities extend from the new class .

android developer
- 114,585
- 152
- 739
- 1,270
1
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