2

I've done a ton of research and literally tried everything that I can think of.

Basically, I have 3 activities

Activity 1 -> Activity 2 -> Activity 3

I have set up a slide_left and slide_right animation files. Basically when the user clicks to go to Activity 2 - the page slides in from the right. But, when the user clicks to go back (the home button on the action bar). It should slide in the opposite direction.

When it gets to Activity 3 and a user rotates the device, the slide animation is going in the wrong direction. =( This only occurs when a user rotates the device.

onCreate()

// Override animation so that it animates as a slide in from left
overridePendingTransition(R.anim.slide_left_in, R.anim.slide_left_out);

It's like it loses the animation changes when the user rotates the device.

I found this bug: https://code.google.com/p/android/issues/detail?id=25994

Does anyone know of a work around?? What's the best way to handle this??

Sandy D.
  • 3,166
  • 1
  • 20
  • 31

1 Answers1

1

I finally figured this out!

In the onCreate() method:

// Only run the animation if we are coming from the parent activity, not if 
// we are recreated automatically by the window manager (e.g. device rotation)
if (savedInstanceState == null) {
     // Override animation so that it animates as a slide in from left
     overridePendingTransition(R.anim.slide_left_in, R.anim.slide_left_out);
}

I have tested this out and it works perfectly.

Reference: https://www.youtube.com/watch?v=CPxkoe2MraA

Sandy D.
  • 3,166
  • 1
  • 20
  • 31