I found this answer, It helped me a lot in understanding the scenario. But, what if i have 100 Activities in my application, and crash can happen in any of them, Is there a possibility that I log all crashes from 1 single place, instead of writing this code in every single activity.
I want to save the stacktrace
in some file, whenever a crash happen in application, and i want to do this globally, not by going into each activity.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Sets the default uncaught exception handler. This handler is invoked
// in case any Thread dies due to an unhandled exception.
Thread.setDefaultUncaughtExceptionHandler(new CustomizedExceptionHandler(
"/mnt/sdcard/"))
;