Skip to content Skip to sidebar Skip to footer

Back Button Will Bring To Home Page After Firebase Logout On App

My issue is very similar to this post: (When I press back button on login page it will go to main menu (after I select yes for logout in MainMenu activity)). Basically, even after

Solution 1:

So the actual solution worked for the author is using finishAffinity() but not the accepted answer. Which worked for me too.

Solution 2:

privatevoidLogout(){
    firebaseAuth.signOut();
    Intent intent = new Intent(SecondActivity.this, MainActivity.class);
     intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                    | Intent.FLAG_ACTIVITY_CLEAR_TOP
                    | Intent.FLAG_ACTIVITY_CLEAR_TASK);
            startActivity(intent);
    finish();
}

**Just try this **

Post a Comment for "Back Button Will Bring To Home Page After Firebase Logout On App"