Note that there are some explanatory texts on larger screens.

plurals
  1. POLoading animation from xml fails on Android 1.5: "Unknown interpolator name: set". How to fix?
    primarykey
    data
    text
    <p>I have an animation specified in xml like this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;set xmlns:android="http://schemas.android.com/apk/res/android"&gt; · &lt;translate android:fromXDelta="0" android:toXDelta="100%p" android:duration="300" android:interpolator="@android:anim/anticipate_overshoot_interpolator" /&gt; · &lt;alpha android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="300" /&gt; &lt;/set&gt; </code></pre> <p>This file is res/anim/push_right_in.xml</p> <p>Then in Java code I try to load it like this:</p> <pre><code>mAnimationRightIn = AnimationUtils.loadAnimation(this, R.anim.push_right_in); </code></pre> <p>It works perfectly fine on 1.6, 2.1, 2.2, but throws an exception on 1.5:</p> <pre><code>clock.ClockSelectActivity}: java.lang.RuntimeException: Unknown interpolator name: set E/AndroidRuntime( 682): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268) E/AndroidRuntime( 682): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284) E/AndroidRuntime( 682): at android.app.ActivityThread.access$1800(ActivityThread.java:112) E/AndroidRuntime( 682): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692) E/AndroidRuntime( 682): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime( 682): at android.os.Looper.loop(Looper.java:123) E/AndroidRuntime( 682): at android.app.ActivityThread.main(ActivityThread.java:3948) E/AndroidRuntime( 682): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 682): at java.lang.reflect.Method.invoke(Method.java:521) E/AndroidRuntime( 682): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782) E/AndroidRuntime( 682): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540) E/AndroidRuntime( 682): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime( 682): Caused by: java.lang.RuntimeException: Unknown interpolator name: set E/AndroidRuntime( 682): at android.view.animation.AnimationUtils.createInterpolatorFromXml(AnimationUtils.java:321) E/AndroidRuntime( 682): at android.view.animation.AnimationUtils.loadInterpolator(AnimationUtils.java:270) E/AndroidRuntime( 682): at android.view.animation.Animation.setInterpolator(Animation.java:290) E/AndroidRuntime( 682): at android.view.animation.Animation.&lt;init&gt;(Animation.java:213) E/AndroidRuntime( 682): at android.view.animation.TranslateAnimation.&lt;init&gt;(TranslateAnimation.java:54) E/AndroidRuntime( 682): at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:115) E/AndroidRuntime( 682): at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:107) E/AndroidRuntime( 682): at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:84) E/AndroidRuntime( 682): at android.view.animation.AnimationUtils.loadAnimation(AnimationUtils.java:64) E/AndroidRuntime( 682): at com.the7art.rockclock.ClockSelectActivity.onCreate(ClockSelectActivity.java:46) E/AndroidRuntime( 682): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123) E/AndroidRuntime( 682): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231) E/AndroidRuntime( 682): ... 11 more </code></pre> <p>Any idea on what causes this and how to fix? I checked some examples xml-defined animations in Android's API samples and they contain almost the same code, with different parameters, so I guess it really should work. </p> <p>I see one way would be to stop defining them in xml and create animations in code, but I'd like to know if there is a way to still do it in xml :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload