Fragment closes after screen rotation

687 Views Asked by At

I found some similar questions here but I couldn't find something specific for my own problem.

I have a FragmentActivity where I have the container for the my fragments. Initialy it loads a MainFragment from which you can navigate to other fragments. The problem occurs when I go from the initial MainFragment to another Fragment, then after screen orientation changes the current Fragment closes and MainFragment starts. It does not give any error messages in the log, so it does not crash it just closes!

Some of the similar solutions show that I have to recreate all the fragments inside the onCreate from the FragmentActivityusing the savedInstanceState.

Do I really have to do it like that or is there an alternative solution for this.

Thank you in advance!

0

There are 0 best solutions below