Terminating Android Activity – Mea Cup O' Jo
Skip to content


Terminating Android Activity

I got a great tip from Mark Murphy @commonsguy on how to terminate Android app.
First – why do you need such awful thing? Here’s one scenario that I run into while trying to reproduce a bug reported by user

  1. Activity calls another application
  2. Original application terminates (basically I’m trying to simulate a very busy phone)
  3. 2nd app calls the original app
  4. Original app restarts from scratch and processes callback

So, how you do it? Very simple – just call

System.exit(0)

I’m going to run some tests but my hunch is the app just drops dead, so don’t expect gracious Activity#onStop or even Activity#onDestroy. Or at least that’s what I think, but for my purpose it’s all right

Posted in Android, Java.


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.