I noticed that
@Override
public boolean onCreateOptionsMenu(Menu menu) {
only gets called once. I need this to get called every time the menu is displayed because I add/remove items from the menu depending on the application state.
is this possible?
Yes. To do that you need to use:
public boolean onPrepareOptionsMenu (Menu menu)
That code will be executed every time before your options menu is shown. More information here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With