Android Build an Interactive Story App The Rest of the Story Maintaining a Custom Back Stack

Clear Stack when pressing Play Again?

At the end of this video it was mentioned that you could fix the problem of going back through multiple stories by clearing the stack when pressing the play again button.

Does anyone know how this would be done? I've looked up some stuff about clearing the stack but I can't see anything for a custom back stack.

1 Answer

Maciej Czuchnowski
Maciej Czuchnowski
36,427 Points

From what I've just tested, it should be enough to just add

pageStack.clear();

in the StoryActivity.java in the loadPage method. just before doing the loadPage(0);.