这个函数注释:
Check to see whether this activity is in the process of finishing, either because you called finish
on it or someone else has requested that it finished. This is often used in onPause
to determine whether the activity is simply pausing or completely finishing.
-
Returns:
- If the activity is finishing, returns true; else returns false. See Also:
- finish
这次项目中,遇到这个问题,一个activity在finish时候,还有收到广播,结果导致bug
在广播接收器中先判断一下比较保险。或者在onDestroy里面注销广播
{
@Override
public void onReceive(Context context, Intent intent)
{
Log.d(TAG, intent.toString());
final String action = intent.getAction();
if(isFinishing())
{
。。。。。。。
return;}
}
还有遇到一个问题,在activity finish时候,这时候handler.sendMessage,这时候也会导致bug
这时候最好在finish函数里面removeAllCallbackAndMessage(this)