java.lang.NullPointerException: Attempt to invoke virtual method 'void 、Handler.removeMessages(int)' on a null object reference

onDestory进行释放Handler时,需要判断null

if(null != mHandler) {
            mHandler.removeMessages(MSG_CHANGE_TEXT_COLOR);
            mHandler.removeMessages(MSG_JUMP_TO_SUCCESS_PAGE);
            mHandler.removeMessages(MSG_PLAY_LITTLE_PEOPLE_ANIMATION);
            mHandler.removeMessages(MSG_PLAY_WRONG_ANIMATION);
            mHandler.removeMessages(MSG_SPEAK_BUTTON_STATE_CHANGED);
            mHandler = null;
            DebugLog.d(TAG, "release Handler success");
}
文章来自:http://www.cnblogs.com/ErLiangCode/p/4781366.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3