So verbergen Sie die Suche im Menü Android Studio vor Aktivität
// put below code in oncreatOptionMenu();
// the use flag as global variable in your class
// change its value as you need the call the function invalidateOptionsMenu()
// this function is call the oncreateOptionMenu()
MenuItem item = menu.findItem(R.id.menu_Done);
if (flag/condition)) {
item.setVisible(false); // its a simple example
} else {
item.setVisible(true);
}
Mohamed Boumlyk