调用 dialog.show(getSupportFragmentManager(), "tag");时出现了java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState的错误。
报错的原因:dialog.show()方法的内部使用了commit()方法提交事务,某些时候因为状态异常而报错。解决方法就是使用commitAllowingStateLoss()方法,具体如下所示:
解决方法:getSupportFragmentManager().beginTransaction().add(dialog, "tag").commitAllowingStateLoss();
原文:https://www.cnblogs.com/yongfengnice/p/10403000.html