3

So I have followed the docs about Providing Up Navigation

However, if I want to customize what the animation transitions look like in xml, I am trying to do something like this

https://gist.github.com/lawloretienne/b8b4f68a779b9f97241f

The enter animations work well, its the exit animations that seem to not get triggered. When the up button is clicked, it will navigate up to the logical parent activity. However instead of the exit animations showing, the enter animations are showing.

Am I missing something here?

Etienne Lawlor
  • 6,817
  • 18
  • 77
  • 89

3 Answers3

4

Your launchMode must have been set to singleInstance. It overrides the transition animation. You should set it to singleTop.

Egor Neliuba
  • 14,784
  • 7
  • 59
  • 77
1

in custome_out_next.xml try this

<translate
        android:interpolator="@android:anim/accelerate_interpolator"
        android:fromXDelta="0"
        android:toXDelta="-100%p"
        android:duration="@android:integer/config_shortAnimTime" />

VikasGoyal
  • 3,308
  • 1
  • 22
  • 42
-1

Reason of this behavior is described in docs link:

  • If the parent activity has launch mode <singleTop>, or the up intent contains FLAG_ACTIVITY_CLEAR_TOP, the parent activity is brought to the top of the stack, and receives the intent through its onNewIntent() method.

  • If the parent activity has launch mode <standard>, and the up intent does not contain FLAG_ACTIVITY_CLEAR_TOP, the parent activity is popped off the stack, and a new instance of that activity is created on top of the stack to receive the intent.

Hamad
  • 5,096
  • 13
  • 37
  • 65