In case you have a BottomBar:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
if (mBottomBar.getCurrentTabId() == R.id.tab_more) {
getMenuInflater().inflate(R.menu.more_menu, menu);
}
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.preferences:
startActivity(new Intent(this, PreferenceActivity.class));
break;
}
return super.onOptionsItemSelected(item);
}
Then you just need to call:
@Override
public void onBottomBarClick(int tabId) {
supportInvalidateOptionsMenu();
}