0

I created an application in which I change a menu item, when I check, the application works with the changes. But when I restart the application, I lose the changes, although the file changed are present in internal storage. i use the function public boolean onMenuOpened(int featureid, Menu menu) {} to make the change. I would like to keep a part of the menu and to change the other.

diez
  • 125
  • 1
  • 5
  • 12

1 Answers1

1

Menu changes aren't saved. You can use OnPrepareOptionsMenu to modify the menu based on some property.

public boolean onPrepareOptionsMenu (Menu menu) {
    if(disableSomething) {
        menu.findItem(R.id.someItemToDisable).setEnabled(false);
    }
    return true;
}
Robby Pond
  • 73,164
  • 16
  • 126
  • 119