Android : Fragments removed after Activity recreate

on Saturday, September 6, 2014


I am developing an app, where fragments are changing in the container of one Activity. I am using FragmentTransaction.replace(R.id.container, fragment, tag) to switch between fragments. All fragments has setRetainInstance(true). When I press Home button and go back to app everything is ok, but when I turn on developers option "Don't keep activities" and do the same, I end up with "clean" activity where there is only the first (initial) fragment presents. In other words, after Activity is recreated all fragments are lost. How can I avoid that and save fragments state?


0 comments:

Post a Comment