0

I've very little knowledge about all this codes, but I'm building an application, and I want to kill the application onPause. Please give me a code by which I can kill the application.

richj
  • 7,499
  • 3
  • 32
  • 50
user728859
  • 55
  • 6
  • 7
    I'M SORRY, I CAN'T HEAR WHAT YOU'RE SAYING. WHAT IS THIS TALK OF KILLING?! KILLING IS BAD! No, seriously - it is. – Codemonkey Apr 28 '11 at 08:22
  • The question is perfectly clear even if it was originally written in capitals. The questioner wants to know how to code an Android application to exit when it receives a pause event. – richj Apr 28 '11 at 08:36
  • 2
    Yeah, sorry, rich. I was not serious and I was trying to make a sarcastic response that also played a little on the concept that completely killing an Android application is bad form. – Codemonkey Apr 28 '11 at 08:39
  • 1
    Hi Klaus. My comment was intended to justify my reopen vote. This looks like a real programming question that could have been (and was) reasonably answered in its original form. I have no problem with jokes in comments, non-native English speakers, or text entered without a standard keyboard. – richj Apr 28 '11 at 09:08
  • to my knowledge ALL CAPS is used to express your anger on screen.. better avoid it user728859 – Jana Apr 28 '11 at 11:00

2 Answers2

1

Please don't use all caps.

... onPause(){
    finish();
}

You shouldn't use System.exit(0); but since your question is in all caps you probably will.

Other ways to exit app and reason to not use System.exit:

Close application and launch home screen on Android

Community
  • 1
  • 1
Blundell
  • 75,855
  • 30
  • 208
  • 233
1

If you want to exit the application then use System.exit in over ridden onPause method

Rasel
  • 15,499
  • 6
  • 40
  • 50