At this part of a talk given at Google I/O 2017, the speaker introduces a new API for setReorderingAllowed()
than can be called on a FragmentTransaction
.
The speaker explains:
It allows all the execution to happen all at once without changing your fragment state and then at the very end we bring up all the fragments that need to be brought up and tear down all the fragments that need to be torn down…so we can optimize this for you.
And shows the following code sample:
fragmentManager.beginTransaction()
.replace(R.id.container, fragment1)
.addToBackStack("state1")
.setReorderingAllowed(true)
.commit();
fragmentManager.beginTransaction()
.replace(R.id.container, fragment2)
.addToBackStack("state2")
.setReorderingAllowed(true)
.commit();
Wouldn't committing the FragmentTransaction
s separately negate any optimization that .setReorderingAllowed(true)
gives you because they are occurring separately?
Since this is a newly announced API it looks like there is no documentation currently available.