0

Let's say I have a fragment transaction that, when originally executed, was set up with these animations:

    transaction.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_right, R.anim.slide_in_right, R.anim.slide_out_left);

Usually, I want the animation to appear when the user goes back. There are occasional cases in which I want to cancel the back animation, and just pop the backstack without animation and immediately execute another replace fragment transaction. Is there a way to cancel the back animations before popping the backstack?

Thanks.

Casey Perkins
  • 1,853
  • 2
  • 23
  • 41
  • When do you call transaction.setCustomAnimations? You can set a flag to know when invoke it or skip. – CoolMind Jun 02 '17 at 20:10
  • The transaction has already been executed. Now we are going to go back from it (pop the backstack). The goal in this case is to NOT use the animations that were originally specified for going back. (Normally we will use them, but in a few cases no). – Casey Perkins Jun 02 '17 at 20:51
  • I still don't see a problem (because didn't encounter it). In the right panel you can see a topic: https://stackoverflow.com/questions/9194311/pop-the-fragment-backstack-without-playing-the-pop-animation?rq=1. – CoolMind Jun 02 '17 at 21:46

0 Answers0