I have a global exception handler routine which wraps some exceptions in runtime exceptions
Like this
public class ExceptionHandler
{
public static void handle(){
throw new RuntimeException(e);
}
}
In the ExceptionHandler
class I also have a static constructor
static
{
Thread.UncaughtExceptionHandler h = new Thread.UncaughtExceptionHandler()
{
@Override
public void uncaughtException(Thread thread, Throwable throwable)
{
Throwable t;
t = throwable;
if (throwable.getCause() != null)
t = throwable.getCause();
Log.e(t.getClass().getName(), t.getMessage(), t);
}
};
Thread.currentThread().setUncaughtExceptionHandler(h);
Thread.setDefaultUncaughtExceptionHandler(h);
}
Problem is, after throwing a RTE it does not enter the UncaughtExceptionHandler
. Why?
BTW, I can't put it into the main method because there is no main in my Android program.