Gjhuizing Gjhuizing - 1 month ago 6
Android Question

Alternative to overridePendingTransition() - Android

I just discovered the android overrivePendingTransition() method. It works fine but I have the following problem :

In the Settings/Dislpay menu, you can choose to show no animations, some animations or all animations, and the method only works when it is set to all animations.

Can I bypass that ?

Answer

The settings you're talking about are user preferences. If one of your users wanted to turn off all animations, why would you want to find a workaround to continue showing animations in your app? It doesn't seem very user-friendly.

At any rate, overridePendingTransition is used to animate between Activities, as opposed to Views which is part of why you can turn them off, and was introduced in Android 2.0. There isn't another SDK method available that does the same thing; however, you can try using a LayoutAnimation to animate the layout you provide for each Activity you're creating. It wouldn't be exactly the same as overridePendingTransition, but I think it's going to be one of the closest things you'll find to an alternative.

your_animation.xml:

<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
android:animation="@anim/THE_ANIMATION_YOU_WANT_TO_USE" />

your_layout.xml:

android:layoutAnimation="@anim/your_animation"
Comments