To get the default error popup, handle the exception and then execute the default uncaught exception handler:
final Thread.UncaughtExceptionHandler defaultHandler =
Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
doCustomHandlingHere();
defaultHandler.uncaughtException(t,e);
}
});
To get a custom error popup, I believe you would have to set the default uncaught exception handler for each activity separately. See this post for details.