Last active
May 13, 2016 15:53
-
-
Save bherbst/38d842618c0a3e746e6b0ff542738b28 to your computer and use it in GitHub Desktop.
Bad backstack management
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void addSubscreen(Fragment fragment) { | |
getSupportManager() | |
.beginTransaction() | |
.replace(R.id.container, fragment) | |
.addToBackStack(null) | |
.commit(); | |
subscreensOnTheStack++; | |
} | |
public void popOffSubscreens() { | |
while (subscreensOnTheStack > 0) { | |
fragments.popBackStackImmediate(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment