1 // Copyright 2007 The Android Open Source Project 2 3 import java.lang.Thread.UncaughtExceptionHandler; 4 5 /** 6 * Report death-by-uncaught-exception. 7 */ 8 public class ThreadDeathHandler implements Thread.UncaughtExceptionHandler { 9 private String mMyMessage; 10 ThreadDeathHandler(String msg)11 public ThreadDeathHandler(String msg) { 12 mMyMessage = msg; 13 } 14 uncaughtException(Thread t, Throwable e)15 public void uncaughtException(Thread t, Throwable e) { 16 System.err.println("Uncaught exception " + mMyMessage + "!"); 17 e.printStackTrace(); 18 } 19 } 20