Please help me understand how back stack works natively when "onBackPressed" is called. I noticed that even though visually it went back to the previous fragment, the fragment that was supposedly popped (that I exited from) is still in the back stack. Why is that? I will then have to resort to
@Override
public void onBackPressed() {
if(getFragmentManager().getBackStackEntryCount() > 0)
getFragmentManager().popBackStack();
}
which seems counter-intuitive. Is it true then to be on a fragment that isn't at the top of the back stack? Not much of a stack then...
Edit: to clarify, my question is why is onBackPressed not popping the back stack already and that an extra call is required to pop it as a workaround? I'm fine if that's just the way it is but I'd like confirmation.