ThreadGroup.UncaughtException(Thread, Throwable) Method

Definition

Called by the Java Virtual Machine when a thread in this thread group stops because of an uncaught exception, and the thread does not have a specific Thread.UncaughtExceptionHandler installed.

[Android.Runtime.Register("uncaughtException", "(Ljava/lang/Thread;Ljava/lang/Throwable;)V", "GetUncaughtException_Ljava_lang_Thread_Ljava_lang_Throwable_Handler")]
public virtual void UncaughtException (Java.Lang.Thread? t, Java.Lang.Throwable? e);
[<Android.Runtime.Register("uncaughtException", "(Ljava/lang/Thread;Ljava/lang/Throwable;)V", "GetUncaughtException_Ljava_lang_Thread_Ljava_lang_Throwable_Handler")>]
abstract member UncaughtException : Java.Lang.Thread * Java.Lang.Throwable -> unit
override this.UncaughtException : Java.Lang.Thread * Java.Lang.Throwable -> unit

Parameters

t
Thread

the thread that is about to exit.

e
Throwable

the uncaught exception.

Implements

Attributes

Remarks

Called by the Java Virtual Machine when a thread in this thread group stops because of an uncaught exception, and the thread does not have a specific Thread.UncaughtExceptionHandler installed.

The uncaughtException method of ThreadGroup does the following: <ul> <li>If this thread group has a parent thread group, the uncaughtException method of that parent is called with the same two arguments. <li>Otherwise, this method checks to see if there is a Thread#getDefaultUncaughtExceptionHandler default uncaught exception handler installed, and if so, its uncaughtException method is called with the same two arguments. <li>Otherwise, this method determines if the Throwable argument is an instance of ThreadDeath. If so, nothing special is done. Otherwise, a message containing the thread's name, as returned from the thread's Thread#getName getName method, and a stack backtrace, using the Throwable's Throwable#printStackTrace printStackTrace method, is printed to the System#err standard error stream. </ul>

Applications can override this method in subclasses of ThreadGroup to provide alternative handling of uncaught exceptions.

Added in 1.0.

Java documentation for java.lang.ThreadGroup.uncaughtException(java.lang.Thread, java.lang.Throwable).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to