Added functionality to onBackPressed(). The function uses the flag isRegisterView to determine which xml layout is currently being displayed and switches accordingly. If the login view is the current view the back button will just exit the app.