2

I am in a situation where I want to have no visible animation during a transition between Activities. I am currently doing the following:

startActivity( intent );
getActivity().overridePendingTransition( 0, 0 );

Works fine. Once in the second Activity, I want to animate LayoutTransitions (for better or for worse) -- specifically, calling addView() on the root view coupled with android:animateLayoutChanges="true" in XML.

Right now, addView() is being called in my onResume() of the second Activity and shows no LayoutTransition animations (just pops the added view in place). I'm guessing that either overridePendingTransitions(int, int) or startActivity() (and thus the override as well) are "in effect" until some specified lifecycle event occurs in the second Activity. But I can't find this information. Should I just assume that it's until the end of onResume()?

Removing a View later, say when the user presses the back button, triggers the LayoutTransition animation fine. But this is unrelated to the Activity lifecycle.

So my question is, at what point does overridePendingTransition( 0, 0 ) release control of animations?

Allison
  • 501
  • 4
  • 15

1 Answers1

0

Release of overridePendingTransition is not associated with any lifecycle event.

overridePendingTransition will release control after the duration of animation is completed.
That is, 300 ms (default duration) or user specified duration (set in XML or using setDuration())

For no visible animation during a transition between Activities, use FLAG_ACTIVITY_NO_ANIMATION

instead of overridePendingTransition

intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity( intent );

Infinite Recursion
  • 6,511
  • 28
  • 39
  • 51
  • 1
    The intent flag didn't work for me, though it's something I've overlooked before now. The default duration information is great, thanks for that! I'm not happy with my implementation in general, so I may not have this problem after all. – Allison Jan 11 '14 at 00:23