I am using a new toolbar on Lollipop (no library support). My activity has a list, and if the list is empty, I don’t want to show the options menu. My implementation is as follows:
in onCreate ():
setActionBar((Toolbar) findViewById(R.id.toolbar));
getActionBar().setDisplayHomeAsUpEnabled(true);
And the menu method:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
if (tasks.isEmpty()) {
return false;
}
getMenuInflater().inflate(R.menu.menu_tasks, menu);
return true;
}
When the method inflates the menu and returns true, the up arrow works; when the method returns false, there is an arrow, but clicking on it does nothing. Is this some kind of Android bug?
wujek source
share