Implement onBackPress() in MainActivity for handling fragment
transitions.