理解:
if(activity.this != null && !activity.this.isFinishing()){光使用commitAllowingStateLoss 还是出现了IllegaleStateException异常,不过极少,偶尔出现1次
为了尽量避免这个问题,不妨再增加对activity的状态判断,效果有待观察
状态异常。java.lang.IllegalStateException异常产生的原因及解决办法 错误类型大致为以下几种:java.lang.IllegalStateException:Cannot forward a response that is already committed IllegalStateException:response already commited IllegalStateException:getOutputStream() has already been called for this request…………=========================================================IllegalStateException: Can not perform this action after onSaveInstanceState:#解决办法:onSaveInstanceState方法是在该Activity即将被销毁前调用,来保存Activity数据的,如果在保存玩状态后再给它添加Fragment就会出错。解决办法就是把commit()方法替换成 commitAllowingStateLoss()