Search code examples
androidandroid-fragmentsandroid-activityandroid-orientationandroid-savedstate

Is a fragment's savedInstanceState shared with the parent activity's savedInstanceState?


Fairly straightforward question but I am unable to find a clear answer anywhere.

Is the savedInstanceState of a fragment the same object as the savedInstanceState of the fragment's parent activity (or encapsulating fragment)?

If so, do I have to be aware of saving too much information within the savedInstanceState? Additionally, could extras within the parent activity's savedInstanceState be overwritten by extras of the same name in the fragment class?


Solution

  • Is the savedInstanceState of a fragment the same object as the savedInstanceState of the fragment's parent activity (or encapsulating fragment)?

    No, it is different objects Bundle


    If so, do I have to be aware of saving too much information within the savedInstanceState?

    here said about how much information can saved in Bundle


    Additionally, could extras within the parent activity's savedInstanceState be overwritten by extras of the same name in the fragment class?

    No, it is different objects Bundle