# IllegalStateException

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Ctors](https://developer.android.com/reference/java/lang/IllegalStateException#pubctors)\|[Inherited Methods](https://developer.android.com/reference/java/lang/IllegalStateException#inhmethods)  

# IllegalStateException

`
public


class
IllegalStateException
`  
`


``


``


``

extends `[RuntimeException](https://developer.android.com/reference/java/lang/RuntimeException)`


``


`

|---|---|---|---|---------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||||
| ↳ | [java.lang.Throwable](https://developer.android.com/reference/java/lang/Throwable) ||||
|   | ↳ | [java.lang.Exception](https://developer.android.com/reference/java/lang/Exception) |||
|   |   | ↳ | [java.lang.RuntimeException](https://developer.android.com/reference/java/lang/RuntimeException) ||
|   |   |   | ↳ | java.lang.IllegalStateException |

|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known direct subclasses [AcceptPendingException](https://developer.android.com/reference/java/nio/channels/AcceptPendingException),[AlreadyBoundException](https://developer.android.com/reference/java/nio/channels/AlreadyBoundException),[AlreadyConnectedException](https://developer.android.com/reference/java/nio/channels/AlreadyConnectedException),[CancellationException](https://developer.android.com/reference/java/util/concurrent/CancellationException),[CancelledKeyException](https://developer.android.com/reference/java/nio/channels/CancelledKeyException),[ClosedDirectoryStreamException](https://developer.android.com/reference/java/nio/file/ClosedDirectoryStreamException),[ClosedFileSystemException](https://developer.android.com/reference/java/nio/file/ClosedFileSystemException),[ClosedSelectorException](https://developer.android.com/reference/java/nio/channels/ClosedSelectorException),[ClosedWatchServiceException](https://developer.android.com/reference/java/nio/file/ClosedWatchServiceException),[ConnectionPendingException](https://developer.android.com/reference/java/nio/channels/ConnectionPendingException),[FormatterClosedException](https://developer.android.com/reference/java/util/FormatterClosedException),[IllegalBlockingModeException](https://developer.android.com/reference/java/nio/channels/IllegalBlockingModeException),[InvalidMarkException](https://developer.android.com/reference/java/nio/InvalidMarkException),[LimitExceededException](https://developer.android.com/reference/android/os/LimitExceededException),[MediaCasStateException](https://developer.android.com/reference/android/media/MediaCasStateException), and 15 others. |------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [AcceptPendingException](https://developer.android.com/reference/java/nio/channels/AcceptPendingException)                                           | Unchecked exception thrown when an attempt is made to initiate an accept operation on a channel and a previous accept operation has not completed.                                                                                                                                                                                                                                                                        | | [AlreadyBoundException](https://developer.android.com/reference/java/nio/channels/AlreadyBoundException)                                             | Unchecked exception thrown when an attempt is made to bind the socket a network oriented channel that is already bound.                                                                                                                                                                                                                                                                                                   | | [AlreadyConnectedException](https://developer.android.com/reference/java/nio/channels/AlreadyConnectedException)                                     | Unchecked exception thrown when an attempt is made to connect a[SocketChannel](https://developer.android.com/reference/java/nio/channels/SocketChannel)that is already connected.                                                                                                                                                                                                                                         | | [CancellationException](https://developer.android.com/reference/java/util/concurrent/CancellationException)                                          | Exception indicating that the result of a value-producing task, such as a[FutureTask](https://developer.android.com/reference/java/util/concurrent/FutureTask), cannot be retrieved because the task was cancelled.                                                                                                                                                                                                       | | [CancelledKeyException](https://developer.android.com/reference/java/nio/channels/CancelledKeyException)                                             | Unchecked exception thrown when an attempt is made to use a selection key that is no longer valid.                                                                                                                                                                                                                                                                                                                        | | [ClosedDirectoryStreamException](https://developer.android.com/reference/java/nio/file/ClosedDirectoryStreamException)                               | Unchecked exception thrown when an attempt is made to invoke an operation on a directory stream that is closed.                                                                                                                                                                                                                                                                                                           | | [ClosedFileSystemException](https://developer.android.com/reference/java/nio/file/ClosedFileSystemException)                                         | Unchecked exception thrown when an attempt is made to invoke an operation on a file and the file system is closed.                                                                                                                                                                                                                                                                                                        | | [ClosedSelectorException](https://developer.android.com/reference/java/nio/channels/ClosedSelectorException)                                         | Unchecked exception thrown when an attempt is made to invoke an I/O operation upon a closed selector.                                                                                                                                                                                                                                                                                                                     | | [ClosedWatchServiceException](https://developer.android.com/reference/java/nio/file/ClosedWatchServiceException)                                     | Unchecked exception thrown when an attempt is made to invoke an operation on a watch service that is closed.                                                                                                                                                                                                                                                                                                              | | [ConnectionPendingException](https://developer.android.com/reference/java/nio/channels/ConnectionPendingException)                                   | Unchecked exception thrown when an attempt is made to connect a[SocketChannel](https://developer.android.com/reference/java/nio/channels/SocketChannel)for which a non-blocking connection operation is already in progress.                                                                                                                                                                                              | | [FormatterClosedException](https://developer.android.com/reference/java/util/FormatterClosedException)                                               | Unchecked exception thrown when the formatter has been closed.                                                                                                                                                                                                                                                                                                                                                            | | [IllegalBlockingModeException](https://developer.android.com/reference/java/nio/channels/IllegalBlockingModeException)                               | Unchecked exception thrown when a blocking-mode-specific operation is invoked upon a channel in the incorrect blocking mode.                                                                                                                                                                                                                                                                                              | | [InvalidMarkException](https://developer.android.com/reference/java/nio/InvalidMarkException)                                                        | Unchecked exception thrown when an attempt is made to reset a buffer when its mark is not defined.                                                                                                                                                                                                                                                                                                                        | | [LimitExceededException](https://developer.android.com/reference/android/os/LimitExceededException)                                                  | Indicates that the app has exceeded a limit set by the System.                                                                                                                                                                                                                                                                                                                                                            | | [MediaCasStateException](https://developer.android.com/reference/android/media/MediaCasStateException)                                               | Base class for MediaCas runtime exceptions                                                                                                                                                                                                                                                                                                                                                                                | | [MediaCodec.CodecException](https://developer.android.com/reference/android/media/MediaCodec.CodecException)                                         | Thrown when an internal codec error occurs.                                                                                                                                                                                                                                                                                                                                                                               | | [MediaDrm.MediaDrmStateException](https://developer.android.com/reference/android/media/MediaDrm.MediaDrmStateException)                             | Thrown when a general failure occurs during a MediaDrm operation.                                                                                                                                                                                                                                                                                                                                                         | | [MediaDrmResetException](https://developer.android.com/reference/android/media/MediaDrmResetException)                                               | This exception is thrown when the MediaDrm instance has become unusable due to a restart of the mediaserver process.                                                                                                                                                                                                                                                                                                      | | [NoConnectionPendingException](https://developer.android.com/reference/java/nio/channels/NoConnectionPendingException)                               | Unchecked exception thrown when the[finishConnect](https://developer.android.com/reference/java/nio/channels/SocketChannel#finishConnect())method of a[SocketChannel](https://developer.android.com/reference/java/nio/channels/SocketChannel)is invoked without first successfully invoking its[connect](https://developer.android.com/reference/java/nio/channels/SocketChannel#connect(java.net.SocketAddress))method. | | [NonReadableChannelException](https://developer.android.com/reference/java/nio/channels/NonReadableChannelException)                                 | Unchecked exception thrown when an attempt is made to read from a channel that was not originally opened for reading.                                                                                                                                                                                                                                                                                                     | | [NonWritableChannelException](https://developer.android.com/reference/java/nio/channels/NonWritableChannelException)                                 | Unchecked exception thrown when an attempt is made to write to a channel that was not originally opened for writing.                                                                                                                                                                                                                                                                                                      | | [NotYetBoundException](https://developer.android.com/reference/java/nio/channels/NotYetBoundException)                                               | Unchecked exception thrown when an attempt is made to invoke an I/O operation upon a server socket channel that is not yet bound.                                                                                                                                                                                                                                                                                         | | [NotYetConnectedException](https://developer.android.com/reference/java/nio/channels/NotYetConnectedException)                                       | Unchecked exception thrown when an attempt is made to invoke an I/O operation upon a socket channel that is not yet connected.                                                                                                                                                                                                                                                                                            | | [OverlappingFileLockException](https://developer.android.com/reference/java/nio/channels/OverlappingFileLockException)                               | Unchecked exception thrown when an attempt is made to acquire a lock on a region of a file that overlaps a region already locked by the same Java virtual machine, or when another thread is already waiting to lock an overlapping region of the same file.                                                                                                                                                              | | [ReadPendingException](https://developer.android.com/reference/java/nio/channels/ReadPendingException)                                               | Unchecked exception thrown when an attempt is made to read from an asynchronous socket channel and a previous read has not completed.                                                                                                                                                                                                                                                                                     | | [ServiceStartNotAllowedException](https://developer.android.com/reference/android/app/ServiceStartNotAllowedException)                               | Exception thrown when an app tries to start a[Service](https://developer.android.com/reference/android/app/Service)when it's not allowed to do so.                                                                                                                                                                                                                                                                        | | [ShutdownChannelGroupException](https://developer.android.com/reference/java/nio/channels/ShutdownChannelGroupException)                             | Unchecked exception thrown when an attempt is made to construct a channel in a group that is shutdown or the completion handler for an I/O operation cannot be invoked because the channel group has terminated.                                                                                                                                                                                                          | | [StartForegroundCalledOnStoppedServiceException](https://developer.android.com/reference/android/app/StartForegroundCalledOnStoppedServiceException) | Exception thrown when[Service.startForeground](https://developer.android.com/reference/android/app/Service#startForeground(int,%20android.app.Notification))is called on a service that's not actually started.                                                                                                                                                                                                           | | [UnsafeStateException](https://developer.android.com/reference/android/app/admin/UnsafeStateException)                                               | Exception thrown when a[DevicePolicyManager](https://developer.android.com/reference/android/app/admin/DevicePolicyManager)operation failed because it was not safe to be executed at that moment.                                                                                                                                                                                                                        | | [WritePendingException](https://developer.android.com/reference/java/nio/channels/WritePendingException)                                             | Unchecked exception thrown when an attempt is made to write to an asynchronous socket channel and a previous write has not completed.                                                                                                                                                                                                                                                                                     | |

|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known indirect subclasses [BackgroundServiceStartNotAllowedException](https://developer.android.com/reference/android/app/BackgroundServiceStartNotAllowedException),[ForegroundServiceStartNotAllowedException](https://developer.android.com/reference/android/app/ForegroundServiceStartNotAllowedException),[ForegroundServiceTypeException](https://developer.android.com/reference/android/app/ForegroundServiceTypeException),[InvalidForegroundServiceTypeException](https://developer.android.com/reference/android/app/InvalidForegroundServiceTypeException),[MissingForegroundServiceTypeException](https://developer.android.com/reference/android/app/MissingForegroundServiceTypeException) |--------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------| | [BackgroundServiceStartNotAllowedException](https://developer.android.com/reference/android/app/BackgroundServiceStartNotAllowedException) | Exception thrown when an app tries to start a background[Service](https://developer.android.com/reference/android/app/Service)when it's not allowed to do so. | | [ForegroundServiceStartNotAllowedException](https://developer.android.com/reference/android/app/ForegroundServiceStartNotAllowedException) | Exception thrown when an app tries to start a foreground[Service](https://developer.android.com/reference/android/app/Service)when it's not allowed to do so. | | [ForegroundServiceTypeException](https://developer.android.com/reference/android/app/ForegroundServiceTypeException)                       | Base exception thrown when an app tries to start a foreground[Service](https://developer.android.com/reference/android/app/Service)without a valid type.      | | [InvalidForegroundServiceTypeException](https://developer.android.com/reference/android/app/InvalidForegroundServiceTypeException)         | Exception thrown when an app tries to start a foreground[Service](https://developer.android.com/reference/android/app/Service)with an invalid type.           | | [MissingForegroundServiceTypeException](https://developer.android.com/reference/android/app/MissingForegroundServiceTypeException)         | Exception thrown when an app tries to start a foreground[Service](https://developer.android.com/reference/android/app/Service)without a type.                 | |

<br />

*** ** * ** ***

Signals that a method has been invoked at an illegal or inappropriate time. In other words, the Java environment or Java application is not in an appropriate state for the requested operation.

## Summary

|                                                                                                                                                                                                    ### Public constructors                                                                                                                                                                                                    ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException#IllegalStateException())`() ` Constructs an IllegalStateException with no detail message.                                                                                                                                                                                                                               |
| ` `[IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException#IllegalStateException(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` s) ` Constructs an IllegalStateException with the specified detail message.                                                                                                                              |
| ` `[IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException#IllegalStateException(java.lang.String,%20java.lang.Throwable))`(`[String](https://developer.android.com/reference/java/lang/String)` message, `[Throwable](https://developer.android.com/reference/java/lang/Throwable)` cause) ` Constructs a new exception with the specified detail message and cause.              |
| ` `[IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException#IllegalStateException(java.lang.Throwable))`(`[Throwable](https://developer.android.com/reference/java/lang/Throwable)` cause) ` Constructs a new exception with the specified cause and a detail message of`(cause==null ? null : cause.toString())`(which typically contains the class and detail message of`cause`). |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Throwable](https://developer.android.com/reference/java/lang/Throwable)` ` |-----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` final void`                                                                                 | ` `[addSuppressed](https://developer.android.com/reference/java/lang/Throwable#addSuppressed(java.lang.Throwable))`(`[Throwable](https://developer.android.com/reference/java/lang/Throwable)` exception) ` Appends the specified exception to the exceptions that were suppressed in order to deliver this exception.                                                                                                                                                                                                            | | ` `[Throwable](https://developer.android.com/reference/java/lang/Throwable)                   | ` `[fillInStackTrace](https://developer.android.com/reference/java/lang/Throwable#fillInStackTrace())`() ` Fills in the execution stack trace.                                                                                                                                                                                                                                                                                                                                                                                    | | ` `[Throwable](https://developer.android.com/reference/java/lang/Throwable)                   | ` `[getCause](https://developer.android.com/reference/java/lang/Throwable#getCause())`() ` Returns the cause of this throwable or`null`if the cause is nonexistent or unknown.                                                                                                                                                                                                                                                                                                                                                    | | ` `[String](https://developer.android.com/reference/java/lang/String)                         | ` `[getLocalizedMessage](https://developer.android.com/reference/java/lang/Throwable#getLocalizedMessage())`() ` Creates a localized description of this throwable.                                                                                                                                                                                                                                                                                                                                                               | | ` `[String](https://developer.android.com/reference/java/lang/String)                         | ` `[getMessage](https://developer.android.com/reference/java/lang/Throwable#getMessage())`() ` Returns the detail message string of this throwable.                                                                                                                                                                                                                                                                                                                                                                               | | ` `[StackTraceElement[]](https://developer.android.com/reference/java/lang/StackTraceElement) | ` `[getStackTrace](https://developer.android.com/reference/java/lang/Throwable#getStackTrace())`() ` Provides programmatic access to the stack trace information printed by[printStackTrace()](https://developer.android.com/reference/java/lang/Throwable#printStackTrace()).                                                                                                                                                                                                                                                    | | ` final `[Throwable[]](https://developer.android.com/reference/java/lang/Throwable)           | ` `[getSuppressed](https://developer.android.com/reference/java/lang/Throwable#getSuppressed())`() ` Returns an array containing all of the exceptions that were suppressed, typically by the`try`-with-resources statement, in order to deliver this exception.                                                                                                                                                                                                                                                                  | | ` `[Throwable](https://developer.android.com/reference/java/lang/Throwable)                   | ` `[initCause](https://developer.android.com/reference/java/lang/Throwable#initCause(java.lang.Throwable))`(`[Throwable](https://developer.android.com/reference/java/lang/Throwable)` cause) ` Initializes the*cause*of this throwable to the specified value.                                                                                                                                                                                                                                                                   | | ` void`                                                                                       | ` `[printStackTrace](https://developer.android.com/reference/java/lang/Throwable#printStackTrace())`() ` Prints this throwable and its backtrace to the standard error stream.                                                                                                                                                                                                                                                                                                                                                    | | ` void`                                                                                       | ` `[printStackTrace](https://developer.android.com/reference/java/lang/Throwable#printStackTrace(java.io.PrintWriter))`(`[PrintWriter](https://developer.android.com/reference/java/io/PrintWriter)` s) ` Prints this throwable and its backtrace to the specified print writer.                                                                                                                                                                                                                                                  | | ` void`                                                                                       | ` `[printStackTrace](https://developer.android.com/reference/java/lang/Throwable#printStackTrace(java.io.PrintStream))`(`[PrintStream](https://developer.android.com/reference/java/io/PrintStream)` s) ` Prints this throwable and its backtrace to the specified print stream.                                                                                                                                                                                                                                                  | | ` void`                                                                                       | ` `[setStackTrace](https://developer.android.com/reference/java/lang/Throwable#setStackTrace(java.lang.StackTraceElement[]))`(`[StackTraceElement[]](https://developer.android.com/reference/java/lang/StackTraceElement)` stackTrace) ` Sets the stack trace elements that will be returned by[getStackTrace()](https://developer.android.com/reference/java/lang/Throwable#getStackTrace())and printed by[printStackTrace()](https://developer.android.com/reference/java/lang/Throwable#printStackTrace())and related methods. | | ` `[String](https://developer.android.com/reference/java/lang/String)                         | ` `[toString](https://developer.android.com/reference/java/lang/Throwable#toString())`() ` Returns a short description of this throwable.                                                                                                                                                                                                                                                                                                                                                                                         | ||
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public constructors

### IllegalStateException

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public IllegalStateException ()
```

Constructs an IllegalStateException with no detail message. A detail message is a String that describes this particular exception.

<br />

### IllegalStateException

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public IllegalStateException (String s)
```

Constructs an IllegalStateException with the specified detail message. A detail message is a String that describes this particular exception.

<br />

|                            Parameters                             ||
|-----|--------------------------------------------------------------|
| `s` | `String`: the String that contains a detailed message <br /> |

### IllegalStateException

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public IllegalStateException (String message, 
                Throwable cause)
```

Constructs a new exception with the specified detail message and cause.

Note that the detail message associated with`cause`is*not*automatically incorporated in this exception's detail message.

<br />

|                                                                                                                                   Parameters                                                                                                                                   ||
|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `message` | `String`: the detail message (which is saved for later retrieval by the[Throwable.getMessage()](https://developer.android.com/reference/java/lang/Throwable#getMessage())method). <br />                                                                            |
| `cause`   | `Throwable`: the cause (which is saved for later retrieval by the[Throwable.getCause()](https://developer.android.com/reference/java/lang/Throwable#getCause())method). (A`null`value is permitted, and indicates that the cause is nonexistent or unknown.) <br /> |

### IllegalStateException

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public IllegalStateException (Throwable cause)
```

Constructs a new exception with the specified cause and a detail message of`(cause==null ? null : cause.toString())`(which typically contains the class and detail message of`cause`). This constructor is useful for exceptions that are little more than wrappers for other throwables (for example,[PrivilegedActionException](https://developer.android.com/reference/java/security/PrivilegedActionException)).

<br />

|                                                                                                                                  Parameters                                                                                                                                  ||
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `cause` | `Throwable`: the cause (which is saved for later retrieval by the[Throwable.getCause()](https://developer.android.com/reference/java/lang/Throwable#getCause())method). (A`null`value is permitted, and indicates that the cause is nonexistent or unknown.) <br /> |