I want to show or hide item in actionbar according to either their is text in the edit text or not
so I did the following
public class Noun
Try this:
@Override
public boolean onPrepareOptionsMenu(Menu menu, MenuInflater inflater) {
super.onPrepareOptionsMenu(menu, inflater);
if (seachEditText.getText().toString().length() > 0) {
menu.findItem(R.id.action_search).setVisible(true);
} else {
menu.findItem(R.id.action_search).setVisible(false);
}
}