title: Ideal way to set global uncaught exception Handler in Android
body: <p>I want to set a global uncaught exception handler for all the threads in my Android application. So, in my <code>Application</code> subclass I set an implementation of <code>Thread.UncaughtExceptionHandler</code> as default handler for uncaught exceptions.</p>
  
  <pre><code>Thread.setDefaultUncaughtExceptionHandler(
                  new DefaultExceptionHandler(this));
  </code></pre>
  
  <p>In my implementation, I am trying to display an <code>AlertDialog</code> displaying appropriate exception message.</p>
  
  <p>However, this doesn't seem to work. Whenever, an exception is thrown for any thread which goes un-handled, I get the stock, OS-default dialog ("Sorry!-Application-has-stopped-unexpectedly dialog").</p>
  
  <p>What is the correct and ideal way to set a default handler for uncaught exceptions?</p>