Failure saving state - target not in fragment manager (setTargetFragment)

后端 未结 8 1427
北荒
北荒 2020-12-23 14:06

I\'ve got a monkey crash whereby

java.lang.IllegalStateException: Failure saving state: FragmentB has target not in fragment manager: FragmentA
at android.s         


        
8条回答
  •  悲哀的现实
    2020-12-23 14:54

    Be sure that you've added both fragments to the backstack!

    I just ran into this issue when adding a new 'called' fragment for result on top of a 'target' fragment. Initially, I was getting the same error, which stopped occurring as soon as I added both fragments to the back stack whenever I used them.

    The issue occurred on screen rotations, so it was easy to reproduce.

提交回复
热议问题