java.lang.IllegalStateException(Can not perform this action after onSaveInstanceState)

烈酒焚心 提交于 2019-12-04 12:31:02

As i can not comment on your question due to less reputation point. I assume this is your public method to change fragment.

public void beginTransaction(ID id, Bundle bundle)

In this method every time you are adding fragment to activity. So if you are adding fragment first time this will work fine but in case of second fragment you should use replace not add

    fragmentManager.beginTransaction()
    .replace(R.id.fragment_container, fragment).commitAllowingStateLoss();

I think after doing this you should not face this problem. or you can use 'replace' for both first and second fragment. I hope this will help you.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!