I am replacing a Fragment with another one:
FragmentTransaction transaction = mFragmentManager.beginTransaction();
transaction.setCustomAnimations(R.anim.enter, R.anim.exit, R.anim.pop_enter, R.anim.pop_exit);
transaction.replace(R.id.main_container, nextFragment, nextFragment.getClass().toString());
transaction.addToBackStack(nextFragment.getClass().toString());
transaction.commit();
however, the fragment thats being replaced, its onSaveInstanceState is not called. what am i doing wrong?
"In a Fragment, all of their lifecycle callbacks are directly tied to their parent Activity. So onSaveInstanceState gets called on the Fragment when its parent Activity has onSaveInstanceState called."
Look at this post:
FragmentActivity onSaveInstanceState not getting called
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With