Quentamia
Quentamia

Reputation: 3294

Can I add a button for settings to every options menu in my application?

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

Answers (2)

android developer
android developer

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

hoshiKuzu
hoshiKuzu

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

Related Questions