1.界面上的Handler销毁,由于Handler可能有延迟处理的消息,如果此时界面销毁了,很可能会出现崩溃,正确的处理技巧为:
if(null != mHandler) {
mHandler.removeCallbacksAndMessages(null);
mHandler = null;
}
-
对消息的check , 有一些 post的消息会有稍许耗时,此时压力,阻塞
if(mHandler.hasMessages(MEDIA_PLAY_WHAT_MESSAGEFLAG))
{
return ;
}
Messagemsg = mHandler.obtainMessage() ;
msg.what= this.MEDIA_PLAY_WHAT_MESSAGEFLAG ;
msg.obj= mMeidaPlayMessageObj ;