解决IllegalStateException: Can not perform this action after onSaveInstanceState

来源:互联网 发布:mac如何隐藏下面的菜单 编辑:程序博客网 时间:2024/06/06 17:02

使用Activity与Fragment遇到的问题

解决方法1:
在Activity内部复写onSaveInstanceState方法

  @Override protected void onSaveInstanceState(Bundle outState) {    //super.onSaveInstanceState(outState);  }

解决方法2:

transaction.commitAllowingStateLoss();//commitAllowingStateLosscommit();
0 0
原创粉丝点击