0

I have 2 fragments the first contains a button which on clicked opens a fragment with a ListView in it. I have a shared element transition for the button to transition into the new fragment (root layout) but I would also like to have this transition in reverse (the list fragment contracts into the button again).

However currently I detect the list item click and send an event to the Activity which pops the listview fragment off the backstack (popBackStackImmediate()) hence does not show the transition.

Is there a good way to allow back navigation while preserving reverse transition to work as well?

Bootstrapper
  • 1,089
  • 3
  • 14
  • 33
  • I have used the `FractionTranslateLinearLayout` class from the answer here, it works well: http://stackoverflow.com/questions/19372436/doing-a-push-fragment-animation – Daniel Nugent May 02 '16 at 19:36

1 Answers1

0

did you try this:

FragmentManager fm = getSupportFragmentManager();
fm.popBackStack();
fm.executePendingTransactions();

PS: use getSupportFragmentManager() if you're using the support library else use getFragmentManager().

ahmed_khan_89
  • 2,755
  • 26
  • 49