Frage

Ok, so I've finally stumbled on the intersting point that finish() does not immediately terminate an activity but instead will continue the calling method to its end and then "finish".

Is there any other way to terminate/abort an activity? Ie, if X then abort(); just bails immediately at that point without executing anything else from the activity?

tia

War es hilfreich?

Lösung

If you want the calling method to exit immediately, just call return; after you call finish().

Andere Tipps

There is not. The finish method is asynchronous, and it does a lot of things. After calling it, you will get, at some point the future, calls to onPause, (probably) onStop and (maybe) onDestroy if Android thinks it needs some memory.

As @joao points, let finish() be the last call in your routine and place a return after it, but do expect the calls to the onXXX methods.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top