Skip to content

Instantly share code, notes, and snippets.

@szeidner
Last active October 16, 2017 17:21
Show Gist options
  • Save szeidner/20a012af02142a9abdacf5b6a3a31a6d to your computer and use it in GitHub Desktop.
Save szeidner/20a012af02142a9abdacf5b6a3a31a6d to your computer and use it in GitHub Desktop.
Flow w/Flow-Navigation and replacing the stack without retaining presenters
// get size of the history
int historySize = Flow.get(context).getHistory().size();
// pop all old history off the stack
History.Builder builder = history.buildUpon();
while (historySize > 1) {
builder.pop();
Flow.get(context).setHistory(builder.build(), Flow.Direction.REPLACE);
historySize--;
}
// set the real destination
Flow.get(context).setHistory(History.single(path), Flow.Direction.REPLACE);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment