1

How to handle custom back navigation in an android activity

view story
linux-howto

http://stackoverflow.com – What is the best practice to handle back navigation in an android activity? Currently I'm building a stack (Stack class) of my own which holds anonymous functions which will be executed onBackPressed(). Please don't be scared of the scala code: val actionStack: mutable.Stack[() => Any] = mutable.Stack( () => { moveTaskToBack(true); finish() } ) override def onBackPressed() { actionStack.pop.apply() } def doSth() = { actionStack.push(() => contentView.removeView(composeView)) } This is working fine, but I was wondering if there is a built in way to achieve this? (HowTos)