public class DeviceException
extends java.lang.Exception
This is a lightweight class. It is expected that its objects will be created dynamically and discarded after use, even in a resource-constrained environment. It therefore has no "set" method for the field used to identify the cause of the exception; that member must be set by the constructor when the object is created.
Each access exception has a code associated with it, indicating the reason for the exception. See the descriptions of the codes for details of the contexts in which each code may occur.
Modifier and Type | Field and Description |
---|---|
static int |
ARGUMENT_EXCEPTION
Parameter error.
|
static int |
BAD_CONTROL_MODE
The device object is not in the proper mode to request this action.
|
static int |
GENERAL_EXCEPTION
Other undefined exception.
|
static int |
NO_IMPLEMENT
the device doesn't support the request will use this code.
|
static int |
NO_PERMISSION
A basic Android application has no permissions associated with it by
default, meaning it can not do anything that would adversely impact the
user experience or any data on the device.
|
static int |
NO_REQUEST_PENDING
No request was pending when
cancelRequest() was invoked. |
static int |
REQUEST_PENDING
A previous request through this device object has not been completed.
|
Constructor and Description |
---|
DeviceException(int code)
Constructs an
DeviceException with the given detail message
code. |
DeviceException(int code,
java.lang.String message)
Constructs an
DeviceException with the given detail message
code and the detail message. |
DeviceException(int code,
java.lang.String message,
java.lang.Throwable throwable)
Constructs an
DeviceException with the given detail message
code, the detail message, throwable. |
DeviceException(java.lang.String message)
Constructs an
DeviceException with the given detail message. |
DeviceException(java.lang.Throwable throwable)
Constructs an
DeviceException with the given throwable. |
Modifier and Type | Method and Description |
---|---|
int |
getCode()
Retrieves the code associated with the exception.
|
java.lang.String |
toString()
return the short introduction of the exception.
|
public static final int BAD_CONTROL_MODE
open()
is called when the control is already open.
open()
is called when
the control is not open.
public static final int NO_IMPLEMENT
public static final int REQUEST_PENDING
public static final int NO_REQUEST_PENDING
cancelRequest()
was invoked. This code is only used by
cancelRequest
methods.public static final int NO_PERMISSION
public static final int GENERAL_EXCEPTION
public static final int ARGUMENT_EXCEPTION
public DeviceException(int code)
DeviceException
with the given detail message
code.
code
- a constant, defined in DeviceException, identifying
the cause of the exceptionpublic DeviceException(java.lang.String message)
DeviceException
with the given detail message.message
- public DeviceException(int code, java.lang.String message)
DeviceException
with the given detail message
code and the detail message.
code
- a constant, defined in DeviceException, identifying
the cause of the exceptionmessage
- public DeviceException(java.lang.Throwable throwable)
DeviceException
with the given throwable.throwable
- public DeviceException(int code, java.lang.String message, java.lang.Throwable throwable)
DeviceException
with the given detail message
code, the detail message, throwable.
code
- a constant, defined in DeviceException, identifying
the cause of the exceptionmessage
- throwable
- public final int getCode()
This method is synchronous.
public java.lang.String toString()
toString
in class java.lang.Throwable