setResult后再次使用commit會(huì)包錯(cuò)誤:java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
commit方法是在Activity的onSaveInstanceState()之后調(diào)用的智厌,因?yàn)閛nSaveInstanceState方法是在該Activity即將被銷毀前調(diào)用,來保存Activity數(shù)據(jù)的间校,如果在保存玩狀態(tài)后
再給它添加Fragment就會(huì)出錯(cuò)。解決辦法就是把commit()方法替換成commitAllowingStateLoss()就行了透葛,其效果是一樣的希停。