I have a simple activity with several fragments that the user can switch between. Only when the first fragment is shown, a back button appears in the app bar.
I already tried to remove the back button in code by adding this to my activity:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
getSupportActionBar().setHomeButtonEnabled(false);
}
return super.onCreateOptionsMenu(menu);
}
But this does not work correctly: initially the back button is actually gone (yay!). But once I change to another fragment and then go back to the first one, the back button is there again.
Where does this back button come from? How can I disable it for good?
