• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Killing android app Programitically

How can I Kill my android application programmitically , when it got any crash.
Following commands are not working in Uncaght Excetion Handler.

1)System.exit(0);
2)int p = android.os.Process.myPid();
android.os.Process.killProcess(p);

Can anyone help for finding correct solution for this problem.
cleardot.gif
 

Attachments

What you have to realise is that your app is not a self-contained process. It's a thread of execution within the Android app container.
Are you aware of the Activity lifecycle? Have a look at this -

https://developer.android.com/guide/components/activities/activity-lifecycle.html

It turns out that someone else asked the question, and the short answer is that you can call finish() to terminate the application -

https://stackoverflow.com/questions/6330200/how-to-quit-android-application-programmatically
 
What you have to realise is that your app is not a self-contained process. It's a thread of execution within the Android app container.
Are you aware of the Activity lifecycle? Have a look at this -

https://developer.android.com/guide/components/activities/activity-lifecycle.html

It turns out that someone else asked the question, and the short answer is that you can call finish() to terminate the application -

https://stackoverflow.com/questions/6330200/how-to-quit-android-application-programmatically

When my application crashes , I m handling it in UnCaught Exception handler and from their I am sending that crash log to my mail id but after that it comes back to the previous activity where we can see the font of text changed but it doesnt do any thing after that.
 

Attachments

Back
Top Bottom