一,常见的异常类型:

RuntimeException 运行时异常

NullPointerException 空指针异常(用if判断来规避,如果空则跳出)

ClassNotFoundException 指定的类没有找到


ArrayIndexOutofBoundsException 数组下标越界

StringIndexOutofBoundsException 字符串索引越界

(采用判断去规避)

ArithmeticException 数学运算异常(除数为0)


ClassCastException 类型转换异常


IllegalArgumentException 非法参数异常

IllegalStateException 非法状态异常


二, 常用的系统主题:

1、黑色无标题:

android:theme="@android:style/Theme.Black.NoTitleBar"

白色无标题

android:theme="@android:style/Theme.Light.NoTitleBar"

2、全屏幕

android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"

3、透明

android:theme="@android:style/Theme.Translucent"

4、桌面壁纸作为背景

android:theme="@android:style/Theme.Wallpaper"

5、对话框

android:theme="@android:style/Theme.Dialog"


三,进程的优先级(从高到低)


1、前台进程(Foreground process)

1) 当前用户操作的Activity进程

2)绑定了当前用户操作的Activity的service所在的进程

3)调用startForeground()的Service;


后台播放音乐。

4)onCreate(), onStart(), or onDestroy() 的service

5)onReceive() 的BroadcastReceiver


2、可见进程(Visible process)

1)处于暂停状态(可见不可操作)的Activity

2)绑定到暂停状态的Activity的Service



3、服务进程 (Service process)

通过startService()启动的Service


4、后台进程(Background process)

处于停止状态(不可见、不可操作)的Activity


5、空进程(Empty process)

为了加快下一个应用的启动速度。