Added in API level 1

IllegalStateException

public class IllegalStateException
extends RuntimeException

java.lang.Object
   ↳ java.lang.Throwable
     ↳ java.lang.Exception
       ↳ java.lang.RuntimeException
         ↳ java.lang.IllegalStateException
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 Unchecked exception thrown when an attempt is made to bind the socket a network oriented channel that is already bound. 
AlreadyConnectedException Unchecked exception thrown when an attempt is made to connect a SocketChannel that is already connected. 
CancellationException Exception indicating that the result of a value-producing task, such as a FutureTask, cannot be retrieved because the task was cancelled. 
CancelledKeyException Unchecked exception thrown when an attempt is made to use a selection key that is no longer valid. 
ClosedDirectoryStreamException Unchecked exception thrown when an attempt is made to invoke an operation on a directory stream that is closed. 
ClosedFileSystemException Unchecked exception thrown when an attempt is made to invoke an operation on a file and the file system is closed. 
ClosedSelectorException Unchecked exception thrown when an attempt is made to invoke an I/O operation upon a closed selector. 
ClosedWatchServiceException Unchecked exception thrown when an attempt is made to invoke an operation on a watch service that is closed. 
ConnectionPendingException Unchecked exception thrown when an attempt is made to connect a SocketChannel for which a non-blocking connection operation is already in progress. 
FormatterClosedException Unchecked exception thrown when the formatter has been closed. 
IllegalBlockingModeException Unchecked exception thrown when a blocking-mode-specific operation is invoked upon a channel in the incorrect blocking mode. 
InvalidMarkException Unchecked exception thrown when an attempt is made to reset a buffer when its mark is not defined. 
LimitExceededException Indicates that the app has exceeded a limit set by the System. 
MediaCasStateException Base class for MediaCas runtime exceptions 
MediaCodec.CodecException Thrown when an internal codec error occurs. 
MediaDrm.MediaDrmStateException Thrown when a general failure occurs during a MediaDrm operation. 
MediaDrmResetException This exception is thrown when the MediaDrm instance has become unusable due to a restart of the mediaserver process. 
NoConnectionPendingException Unchecked exception thrown when the finishConnect method of a SocketChannel is invoked without first successfully invoking its connect method. 
NonReadableChannelException Unchecked exception thrown when an attempt is made to read from a channel that was not originally opened for reading. 
NonWritableChannelException Unchecked exception thrown when an attempt is made to write to a channel that was not originally opened for writing. 
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 Unchecked exception thrown when an attempt is made to invoke an I/O operation upon a socket channel that is not yet connected. 
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 Unchecked exception thrown when an attempt is made to read from an asynchronous socket channel and a previous read has not completed. 
ServiceStartNotAllowedException Exception thrown when an app tries to start a Service when it's not allowed to do so. 
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 Exception thrown when Service.startForeground is called on a service that's not actually started. 
UnsafeStateException Exception thrown when a DevicePolicyManager operation failed because it was not safe to be executed at that moment. 
WritePendingException Unchecked exception thrown when an attempt is made to write to an asynchronous socket channel and a previous write has not completed. 
BackgroundServiceStartNotAllowedException Exception thrown when an app tries to start a background Service when it's not allowed to do so. 
ForegroundServiceStartNotAllowedException Exception thrown when an app tries to start a foreground Service when it's not allowed to do so. 
ForegroundServiceTypeException Base exception thrown when an app tries to start a foreground Service without a valid type. 
InvalidForegroundServiceTypeException Exception thrown when an app tries to start a foreground Service with an invalid type. 
MissingForegroundServiceTypeException Exception thrown when an app tries to start a foreground Service without a type. 


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()

Constructs an IllegalStateException with no detail message.

IllegalStateException(String s)

Constructs an IllegalStateException with the specified detail message.

IllegalStateException(String message, Throwable cause)

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

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).

Inherited methods

final void addSuppressed(Throwable exception)

Appends the specified exception to the exceptions that were suppressed in order to deliver this exception.

Throwable fillInStackTrace()

Fills in the execution stack trace.

Throwable getCause()

Returns the cause of this throwable or null if the cause is nonexistent or unknown.

String getLocalizedMessage()

Creates a localized description of this throwable.

String getMessage()

Returns the detail message string of this throwable.

StackTraceElement[] getStackTrace()

Provides programmatic access to the stack trace information printed by printStackTrace().

final 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 initCause(Throwable cause)

Initializes the cause of this throwable to the specified value.

void printStackTrace()

Prints this throwable and its backtrace to the standard error stream.

void printStackTrace(PrintWriter s)

Prints this throwable and its backtrace to the specified print writer.

void printStackTrace(PrintStream s)

Prints this throwable and its backtrace to the specified print stream.

void setStackTrace(StackTraceElement[] stackTrace)

Sets the stack trace elements that will be returned by getStackTrace() and printed by printStackTrace() and related methods.

String toString()

Returns a short description of this throwable.

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(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(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()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public constructors

IllegalStateException

Added in API level 1
public IllegalStateException ()

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

IllegalStateException

Added in API level 1
public IllegalStateException (String s)

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

Parameters
s String: the String that contains a detailed message

IllegalStateException

Added in API level 1
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.

Parameters
message String: the detail message (which is saved for later retrieval by the Throwable.getMessage() method).

cause Throwable: the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)

IllegalStateException

Added in API level 1
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).

Parameters
cause Throwable: the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)