Compartilhar via


Instrumentation.OnException(Object, Throwable) Method

Definition

This is called whenever the system captures an unhandled exception that was thrown by the application.

[Android.Runtime.Register("onException", "(Ljava/lang/Object;Ljava/lang/Throwable;)Z", "GetOnException_Ljava_lang_Object_Ljava_lang_Throwable_Handler")]
public virtual bool OnException (Java.Lang.Object? obj, Java.Lang.Throwable? e);
[<Android.Runtime.Register("onException", "(Ljava/lang/Object;Ljava/lang/Throwable;)Z", "GetOnException_Ljava_lang_Object_Ljava_lang_Throwable_Handler")>]
abstract member OnException : Java.Lang.Object * Java.Lang.Throwable -> bool
override this.OnException : Java.Lang.Object * Java.Lang.Throwable -> bool

Parameters

obj
Object

The client object that generated the exception. May be an Application, Activity, BroadcastReceiver, Service, or null.

e
Throwable

The exception that was thrown.

Returns

To allow normal system exception process to occur, return false. If true is returned, the system will proceed as if the exception didn't happen.

Attributes

Remarks

This is called whenever the system captures an unhandled exception that was thrown by the application. The default implementation simply returns false, allowing normal system handling of the exception to take place.

Java documentation for android.app.Instrumentation.onException(java.lang.Object, 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