customAnimation when calling popBackStack on a FragmentManager

After further reading of the documentation, I found that using this signature of setCustomAnimation allowed the animation to be played when pressing the back button or calling getFragmentManager().popBackStack();

I modified my code like this

...
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out, android.R.animator.fade_in, android.R.animator.fade_out);
anomalieFragment = new AnomalieListFragment();
ft.replace(R.id.content, anomalieFragment);
ft.addToBackStack(null);
ft.commit();
...

Leave a Comment

tech