title: Java uncaughtExceptionHandler not working
body: <p>I have a global exception handler routine which wraps <em>some</em> exceptions in runtime exceptions</p>
  
  <p>Like this</p>
  
  <pre><code>public class ExceptionHandler
  {
  public static void handle(){
      throw new RuntimeException(e);
  }
  }
  </code></pre>
  
  <p>In the <code>ExceptionHandler</code> class I also have a static constructor</p>
  
  <pre><code>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);
    }
  </code></pre>
  
  <p>Problem is, after throwing a RTE it does not enter the <code>UncaughtExceptionHandler</code>. Why?</p>
  
  <p>BTW, I can't put it into the main method because there is no main in my Android program.</p>