to top
Android APIs
public class

InvocationTargetException

extends Exception
java.lang.Object
   ↳ java.lang.Throwable
     ↳ java.lang.Exception
       ↳ java.lang.reflect.InvocationTargetException

Class Overview

This class provides a wrapper for an exception thrown by a Method or Constructor invocation.

Summary

Public Constructors
InvocationTargetException(Throwable exception)
Constructs a new InvocationTargetException instance with its cause / target exception filled in.
InvocationTargetException(Throwable exception, String detailMessage)
Constructs a new InvocationTargetException instance with its cause / target exception and message filled in.
Protected Constructors
InvocationTargetException()
Constructs a new InvocationTargetException instance with a null cause / target exception.
Public Methods
Throwable getCause()
Returns the cause of this exception, which may be null.
Throwable getTargetException()
Returns the target exception, which may be null.
[Expand]
Inherited Methods
From class java.lang.Throwable
From class java.lang.Object

Public Constructors

public InvocationTargetException (Throwable exception)

Since: API Level 1

Constructs a new InvocationTargetException instance with its cause / target exception filled in.

Parameters
exception the exception which occurred while running the Method or Constructor

public InvocationTargetException (Throwable exception, String detailMessage)

Since: API Level 1

Constructs a new InvocationTargetException instance with its cause / target exception and message filled in.

Parameters
exception the exception which occurred while running the Method or Constructor
detailMessage the detail message for the exception

Protected Constructors

protected InvocationTargetException ()

Since: API Level 1

Constructs a new InvocationTargetException instance with a null cause / target exception.

Public Methods

public Throwable getCause ()

Since: API Level 1

Returns the cause of this exception, which may be null.

Returns
  • the cause of this exception

public Throwable getTargetException ()

Since: API Level 1

Returns the target exception, which may be null.

Returns
  • the target exception