'IllegalStateException: Activity has been destroyed' when 'getSupportFragmentManager()' called after Activity restart

后端 未结 5 1348
猫巷女王i
猫巷女王i 2020-12-30 11:57

I have a parent Fragment Activity that has a ViewPager which contains a child ViewPager. The child ViewPager contains Fragments for each page. I communicate between these ch

5条回答
  •  没有蜡笔的小新
    2020-12-30 12:25

    Committing transactions in OnPostResume callback fixed the issue for me. Thanks to following blogpost http://www.androiddesignpatterns.com/2013/08/fragment-transaction-commit-state-loss.html

    @Override
    protected void onPostResume() {
        super.onPostResume();
        // Commit your transactions here.
    }
    

提交回复
热议问题