Skip to content

Commit

Permalink
Fixed the issue of stuff showing after clear the back stack.
Browse files Browse the repository at this point in the history
  • Loading branch information
JayTSmith committed Nov 1, 2017
1 parent 16b20d8 commit 396b187
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ public boolean onNavigationItemSelected(MenuItem item) {
int id = item.getItemId();
Fragment contentFragment = new SplashScreenFragment();

Util.clearBackStack(this);

FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(R.id.content_frame, contentFragment);
ft.commit();
Expand All @@ -157,9 +159,6 @@ public boolean onNavigationItemSelected(MenuItem item) {

if (contentFragment != null){
ft.replace(R.id.content_frame, contentFragment);

// Clears the back stack
Util.clearBackStack(this);
}

DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public static void clearBackStack(Fragment fragment) {
}

public static void clearBackStack(FragmentManager fragmentManager) {
while (fragmentManager.getBackStackEntryCount() > 0) {
fragmentManager.popBackStack();
if (fragmentManager.getBackStackEntryCount() > 0) {
fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
}
}
}

0 comments on commit 396b187

Please sign in to comment.