I thought the system would reverse animations on the backstack when the back button is pressed when using fragments using the following code:
FragmentManager fm = getFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.setCustomAnimations(R.anim.slide_in, R.anim.hyperspace_out);
ft.replace(R.id.viewContainer, new class(), "layout").addToBackStack(null).commit();
According to the android documentation for custom animation:
Change:
ft.setCustomAnimations(R.anim.slide_in, R.anim.hyperspace_out);
To:
ft.setCustomAnimations(R.anim.slide_in, R.anim.hyperspace_out, R.anim.hyperspace_in, R.anim.slide_out );
and now the backstack animates - In reverse!!