Skip to content Skip to sidebar Skip to footer

Issue With Getsupportfragmentmanager().putfragment

I am developing an android application and I want to save my fragment that is in the vector fragments. When I use putFragment in onSaveIstanceState the system throw IllegalStateExc

Solution 1:

You can't do any fragment transactions after savedInstanceState() was called.

The activity will restore the last attached fragment when the activity returns.

And if you want to do any actions with fragments use:

getSupportFragmentManager().beginTransaction().add(R.layout.container,new MyFragment(), "fragment_tag").commit();

A very good tutorial about fragments

Post a Comment for "Issue With Getsupportfragmentmanager().putfragment"