Reputation: 1523
Does it is possible to Display/Hide the Fragment Option Menu with some condition. I have a fragment from which I add another fragment with some argument.
According to the valid argument condition I have to render Option menu in toolbar.
I tried put some condition in OnCreateOptionMenu but it didn't worked. Any lead will be really helpful.
Upvotes: 0
Views: 791
Reputation: 221
If you are dealing with a fragment use in your onCreate method:
if(condition) {
setHasOptionsMenu(false);
} else {
setHasOptionsMenu(true);
}
Upvotes: 1