I want to do some specific piece of code on settings->applications->manage applications->app name->force stop button.How can I get this force stop button event?is it possible to get this event?
Asked
Active
Viewed 1,195 times
-3
-
possible duplicate of [How to give event on force close dialog's ok button](http://stackoverflow.com/questions/6826704/how-to-give-event-on-force-close-dialogs-ok-button) – Andro Selva Aug 07 '13 at 06:31
-
dont think it is possible to get fc dialogs button – Boris Mocialov Aug 07 '13 at 06:32
-
http://stackoverflow.com/questions/6826704/how-to-give-event-on-force-close-dialogs-ok-button – Arash GM Aug 07 '13 at 06:32
-
Any one know how to get settings->apps->manage app->force stop button event?? – Nitish Patel Aug 07 '13 at 09:17
1 Answers
2
You can't do that because that dialog is shown by Android OS and you have no control over that part. What you need to do is simply make sure your Android code is clean and correct, so you will get rid of such errors. Another thing you can do (but I strongly recommend to not let loose your app in the wild with this) is to set a DefaultUncaughtExceptionHandler
. Ex:
Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
public void uncaughtException(Thread thread, Throwable ex) {
// log, or create some statistics ... whatever
}
});
But from experience, the behavior of the app once that thread is dead (especially the UI thread) might be unexpected, so maybe it's preferable to have your app dead. But again: you must fix the cases when the app crashes.

gunar
- 14,660
- 7
- 56
- 87