Android RuntimeException汇总

Android中的RuntimeException的直接子类

(有些还没有碰到过,所以后续继续更新)

ActivityNotFoundException

Activity未找到异常

This exception is thrown when a call to startActivity(Intent) or one of its variants fails because an Activity can not be found to execute the given Intent. 

这种异常通常是由Intent启动一个新的Activity时,却找不到指定的Activity时抛出异常

AndroidRuntimeException

Android运行时出错的异常

Base class for all unchecked exceptions thrown by the Android frameworks. 

这种异常通常是由于基类中未检测到的异常被抛出

AnnotationTypeMismatchException Indicates that an annotation type has changed since it was compiled or serialized. 

ArithmeticException

算术运算错误异常

Thrown when the an invalid arithmetic operation is attempted. 

这种异常通常是由于进行了非法的算术运算(例如0为被除数)而产生的

ArrayStoreException

数组存储异常  

Thrown when a program attempts to store an element of an incompatible type in an array. 

这种异常是由于程序试图将一个与数组元素类型不同的元素存入数组时抛出的异常

BufferOverflowException

缓冲区上溢

BufferOverflowException is thrown when elements are written to a buffer but there is not enough remaining space in the buffer. 

这种异常产生的原因是由于程序试图向一个缓冲区中写入数据,但由于缓冲区已满导致了溢出现象的产生

BufferUnderflowException

缓冲区下溢

BufferUnderflowException is thrown when elements are read from a buffer but there are not enough remaining elements in the buffer. 

这种异常产生的原因是由于程序试图从一个缓冲区中读出数据,但由于缓冲区中没有数据导致读到了非法内存中的数据产生的异常

ClassCastException

类的类型强制转换错误

Thrown when a program attempts to cast a an object to a type with which it is not compatible. 

类的类型强制转换错误

ConcurrentModificationException

An ConcurrentModificationException is thrown when a Collection is modified and an existing iterator on the Collection is used to modify the Collection as well. 
DOMException DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impossible to perform (either for logical reasons, because data is lost, or because the implementation has become unstable). 

EmptyStackException

空栈异常

An EmptyStackException is thrown if the pop/peek method of a stack is executed on an empty stack. 

这种异常产生的原因是由于程序试图从一个空栈中弹出数据

EnumConstantNotPresentException

枚举类型异常

Thrown if an enum constant does not exist for a particular name. 

这种异常产生的原因是由于程序中出现了枚举类型中并未定义出现的名字

Fragment.InstantiationException

Fragment初始化异常

Thrown by instantiate(Context, String, Bundle) when there is an instantiation failure. 

如果初始化Fragment出错时则会抛出这个异常

GLException

OpenGL类异常

An exception class for OpenGL errors. 

这是由于OpenGL类出错时抛出的异常

IllegalArgumentException

非法参数错误

Thrown when a method is invoked with an argument which it can not reasonably deal with. 

这个异常通常由于一个方法调用时参数给定时出现了错误

IllegalMonitorStateException

非法监视器状态异常

Thrown when a monitor operation is attempted when the monitor is not in the correct state, for example when a thread attempts to exit a monitor which it does not own. 

这种异常通常是由于线程中wait()函数和notify()函数的问题

IllegalStateException

非正常状态异常

Thrown when an action is attempted at a time when the VM is not in the correct state. 

这种异常是由于虚拟机没处于正常状态,而程序试图在其上面运行时出现的错误

IncompleteAnnotationException

不完全注释异常

Indicates that an element of an annotation(注释) type was accessed that was added after the type was compiled or serialized. 

这是由于注释部分出现了错误

IndexOutOfBoundsException

索引范围越界异常

Thrown when a program attempts to access a value in an indexable collection using a value which is outside of the range of valid indices. 

这种异常是由于程序索引的值超过了可索引容器的可索引的范围

InflateException

XML文件解析错误

This exception is thrown by an inflater on error conditions. 

这种异常通常是由于XML文件解析错误

LSException Parser or write operations may throw an LSException if the processing is stopped. 

MalformedParameterizedTypeException

Indicates that a malformed parameterized type has been encountered by a reflective method. 
MediaCodec.CryptoException Thrown when a crypto error occurs while queueing a secure input buffer. 

MissingResourceException

缺少环境资源异常

MissingResourceException is thrown by ResourceBundle when a resource bundle cannot be found or a resource is missing from a resource bundle. 

这种异常通常是由ResourceBundle这个类抛出的,当他找不到相应的属性文件时就会出现异常

NegativeArraySizeException

数组大小为非正数时的异常

Thrown when an attempt is made to create an array with a size of less than zero. 

创建数组时指定数组大小小于0时抛出的异常

NetworkOnMainThreadException

网络操作在main函数中进行异常

The exception that is thrown when an application attempts to perform a networking operation on its main thread. 

这种异常产生的原因是有关网络连接的操作在main函数中进行时抛出的异常

NoSuchElementException Thrown when trying to retrieve an element past the end of an Enumeration or Iterator. 

NoSuchPropertyException

没有这种属性的异常

Thrown when code requests a Property on a class that does not expose the appropriate method or field. 

这种异常通常出现在代码中请求访问某种属性,但并没有合适的方法或者是成员时会抛出这种异常

NullPointerException

空指针错误

Thrown when a program tries to access a field or method of an object or an element of an array when there is no instance or array to use, that is if the object or array points to null

这种异常是由于程序试图访问一个成员但是由于引用所指向的对象并没有实例化所以会产生空指针错误

OperationCanceledException

操作取消异常

An exception type that is thrown when an operation in progress is canceled. 

当在进程中某个操作被取消时抛出该异常

ParcelFormatException The contents of a Parcel (usually during unmarshalling) does not contain the expected data. 
ParseException Indicates a parse error. 
ProviderException ProviderException is a general exception, thrown by security Providers
RSRuntimeException Base class for all exceptions thrown by the Android RenderScript  
RejectedExecutionException Exception thrown by an Executor when a task cannot be accepted for execution. 
RemoteViews.ActionException Exception to send when something goes wrong executing an action  
Resources.NotFoundException This exception is thrown by the resource APIs when a requested resource can not be found. 

SQLException

SQL异常

An exception that indicates there was an error with SQL parsing or execution. 

当SQL语句的语法规则或者是执行时出现错误时抛出这种异常

SecurityException Thrown when a security manager check fails. 
StaleDataException This exception is thrown when a Cursor contains stale data and must be requeried before being used again. 

Surface.OutOfResourcesException

Surface访问不到指定资源异常

Exception thrown when a Canvas couldn't be locked with lockCanvas(Rect), or when a SurfaceTexture could not successfully be allocated. 

这种异常同时是由于Surface不能锁定画布时抛出异常

SurfaceHolder.BadSurfaceTypeException Exception that is thrown from lockCanvas() when called on a Surface whose type is SURFACE_TYPE_PUSH_BUFFERS. 

TimeFormatException

时间格式出错

 

TypeNotPresentException

 

Thrown when a program tries to access a class, interface, enum or annotation type through a string that contains the type's name and the type cannot be found. 
UndeclaredThrowableException This class provides a wrapper for an undeclared, checked exception thrown by an InvocationHandler. 
UnsupportedDigestAlgorithmException Authentication credentials required to respond to a authentication challenge are invalid 
UnsupportedOperationException Thrown when an unsupported operation is attempted. 
WindowManager.BadTokenException Exception that is thrown when trying to add view whose WindowManager.LayoutParams token is invalid. 
WindowManager.InvalidDisplayException Exception that is thrown when calling addView(View, ViewGroup.LayoutParams) to a secondary display that cannot be found. 
posted @ 2014-03-28 22:36  woshijpfgg  阅读(707)  评论(0编辑  收藏  举报