After upgrading to the new appcoppat library com.android.support:appcompat-v7:25.1.0 I have a new fragment life cycle when replacing fragments in a transaction.
eg. I have two fragments FrFirst and FrSecond with logs in onStart and onStop , and first I replace the second, and then the second: FrFirst -> FrSecond -> FrFirst .
getActivity().getSupportFragmentManager() .beginTransaction() .replace(R.id.content, new FrSecond()) .commit();
In a previous version of appcompat, I can read these logs:
FrFirst: go to the second
Frst: stop
FrSecond: start
FrSecond: go to first
Frsecond: stop
FrFirst: The Beginning
At 25.1.0 these logs:
FrFirst: go to the second
Frsecond: start
Frst: stop
FrSecond: go to first
FrFirst: get started
Frsecond: stop
So, now the onStart view of the fragment called before this onStop current.
Why is the order of the methods changed, is it a bug in the support library?
source share