Android: Custom Animation lost after Orientation change -


i've done ton of research , literally tried can think of.

basically, have 3 activities

activity 1 -> activity 2 -> activity 3

i have set slide_left , slide_right animation files. when user clicks go activity 2 - page slides in right. but, when user clicks go (the home button on action bar). should slide in opposite direction.

when gets activity 3 , user rotates device, slide animation going in wrong direction. =( occurs when user rotates device.

oncreate()

// override animation animates slide in left overridependingtransition(r.anim.slide_left_in, r.anim.slide_left_out); 

it's loses animation changes when user rotates device.

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

does know of work around?? what's best way handle this??

i figured out!

in oncreate() method:

// run animation if coming parent activity, not if  // recreated automatically window manager (e.g. device rotation) if (savedinstancestate == null) {      // override animation animates slide in left      overridependingtransition(r.anim.slide_left_in, r.anim.slide_left_out); } 

i have tested out , works perfectly.

reference: https://www.youtube.com/watch?v=cpxkoe2mraa


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -