Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to hide search from menu android studio from activity

// 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); 
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #hide #search #menu #android #studio #activity
ADD COMMENT
Topic
Name
3+4 =