0

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!

Aksiom
  • 1,565
  • 4
  • 25
  • 39
  • You need to handle orientation changes http://www.androiddesignpatterns.com/2013/04/retaining-objects-across-config-changes.html – Talha Nov 11 '14 at 09:27
  • You see MainFragment again because the activity gets recreated and it is loaded on the onCreate as default fragment – MineConsulting SRL Nov 11 '14 at 09:33
  • There is http://stackoverflow.com/a/17135346/3225458 I think the best way to keep your app state. – romtsn Nov 11 '14 at 09:59

0 Answers0