动画一直在三星星系上崩溃

时间:2013-06-22 19:40:01

标签: android animation samsung-mobile

我有一个问题是我的应用程序一直在崩溃我想要做的动画。它在我的Razr版本4.1.2上运行正常,但在星系上它与NumberFormatException崩溃,它的版本为2.3.6。

任何人都可以告诉我为什么会崩溃吗?我仍在试图弄清楚这是否是一个sdk版本问题。此外,我试图在三星S3上安装我签名的.apk,它甚至不会安装。它只是给我一个空白的屏幕。这似乎只是三星手机的一个问题。

    public class RSEanimation extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);     
        super.setContentView(R.layout.startup);
        final ImageView animationTarget1 = (ImageView) this.findViewById(R.id.rseImage);
        final TextView animationTarget2 = (TextView) this.findViewById(R.id.textView1);
        final TextView animationTarget3 = (TextView) this.findViewById(R.id.textView2);
        final TextView animationTarget4 = (TextView) this.findViewById(R.id.textView3);
        Animation animation = AnimationUtils.loadAnimation(this, R.anim.scale);
        final Animation animation1 = AnimationUtils.loadAnimation(this, R.anim.left_to_right);
        final Animation animation2 = AnimationUtils.loadAnimation(this, R.anim.left_to_right);
        final Animation animation3 = AnimationUtils.loadAnimation(this, R.anim.left_to_right);
        final Animation animation4 = AnimationUtils.loadAnimation(this, R.anim.right_to_left);
        animationTarget1.startAnimation(animation);
        animationTarget4.setVisibility(View.VISIBLE);
        animationTarget4.startAnimation(animation1);        

        animation1.setAnimationListener(new AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {}
            @Override
            public void onAnimationRepeat(Animation animation) {} 
            @Override
            public void onAnimationEnd(Animation animation) {
                animationTarget3.setVisibility(View.VISIBLE);
                animationTarget3.startAnimation(animation2);
            }
        });
        animation2.setAnimationListener(new AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {}
            @Override
            public void onAnimationRepeat(Animation animation) {}
            @Override
            public void onAnimationEnd(Animation animation) {
                animationTarget2.setVisibility(View.VISIBLE);
                animationTarget2.startAnimation(animation3);
            }
        });
        animation3.setAnimationListener(new AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {}

            @Override
            public void onAnimationRepeat(Animation animation) {
            }
            @Override
            public void onAnimationEnd(Animation animation) {
                animationTarget1.startAnimation(animation4);
                animationTarget2.startAnimation(animation4);
                animationTarget3.startAnimation(animation4);
                animationTarget4.startAnimation(animation4);
            }
        });
        animation4.setAnimationListener(new AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {}

            @Override
            public void onAnimationRepeat(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                animationTarget1.setVisibility(View.INVISIBLE);
                animationTarget2.setVisibility(View.INVISIBLE);
                animationTarget3.setVisibility(View.INVISIBLE);
                animationTarget4.setVisibility(View.INVISIBLE);
                 RSEanimation.this.startActivity(new Intent(RSEanimation.this, RiverConditionsActivity.class));

            }
        });


       }

     @Override
        public void onRestart() {
              super.onRestart();   
                  finish();
     }
    }

logcat的:

06-22 19:53:41.164: W/ResourceType(5374): Entry identifier 0x12c is larger than entry count 0xac
06-22 19:53:41.187: W/Resources(5374): Converting to float: TypedValue{t=0x6/d=0x20c530 a=-1}
06-22 19:53:41.187: W/dalvikvm(5374): threadid=1: thread exiting with uncaught exception (group=0x40015578)
06-22 19:53:41.195: E/AndroidRuntime(5374): FATAL EXCEPTION: main
06-22 19:53:41.195: E/AndroidRuntime(5374): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.rse.jamesriver/com.rse.jamesriver.RSEanimation}: java.lang.NumberFormatException
06-22 19:53:41.195: E/AndroidRuntime(5374):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
06-22 19:53:41.195: E/AndroidRuntime(5374):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
06-22 19:53:41.195: E/AndroidRuntime(5374):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-22 19:53:41.195: E/AndroidRuntime(5374):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
06-22 19:53:41.195: E/AndroidRuntime(5374):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-22 19:53:41.195: E/AndroidRuntime(5374):     at android.os.Looper.loop(Looper.java:130)
06-22 19:53:41.195: E/AndroidRuntime(5374):     at android.app.ActivityThread.main(ActivityThread.java:3687)
06-22 19:53:41.195: E/AndroidRuntime(5374):     at java.lang.reflect.Method.invokeNative(Native Method)
06-22 19:53:41.195: E/AndroidRuntime(5374):     at java.lang.reflect.Method.invoke(Method.java:507)
06-22 19:53:41.195: E/AndroidRuntime(5374):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
06-22 19:53:41.195: E/AndroidRuntime(5374):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
06-22 19:53:41.195: E/AndroidRuntime(5374):     at dalvik.system.NativeStart.main(Native Method)
06-22 19:53:41.195: E/AndroidRuntime(5374): Caused by: java.lang.NumberFormatException
06-22 19:53:41.195: E/AndroidRuntime(5374):     at org.apache.harmony.luni.util.FloatingPointParser.parseFltImpl(Native Method)
06-22 19:53:41.195: E/AndroidRuntime(5374):     at org.apache.harmony.luni.util.FloatingPointParser.parseFloat(FloatingPointParser.java:321)
06-22 19:53:41.195: E/AndroidRuntime(5374):     at java.lang.Float.parseFloat(Float.java:323)
06-22 19:53:41.195: E/AndroidRuntime(5374):     at android.content.res.TypedArray.getFloat(TypedArray.java:287)
06-22 19:53:41.195: E/AndroidRuntime(5374):     at  06-22 19:53:41.195:E/AndroidRuntime(5374):  at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:110)
06-22 19:53:41.195: E/AndroidRuntime(5374):     at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:106)
06-22 19:53:41.195: E/AndroidRuntime(5374):     at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:83)
06-22 19:53:41.195: E/AndroidRuntime(5374):     at android.view.animation.AnimationUtils.loadAnimation(AnimationUtils.java:64)
06-22 19:53:41.195: E/AndroidRuntime(5374):     at com.rse.jamesriver.RSEanimation.onCreate(RSEanimation.java:25)
06-22 19:53:41.195: E/AndroidRuntime(5374):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-22 19:53:41.195: E/AndroidRuntime(5374):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)

LEFT_TO_RIGHT

    <set xmlns:android="http://schemas.android.com/apk/res/android"
 android:shareInterpolator="false">
 <translate android:fromXDelta="-200%" android:toXDelta="0%"
         android:fromYDelta="0%" android:toYDelta="0%"
         android:duration="500"
         android:startOffset="100"/>
  </set>

RIGHT_TO_LEFT

    <set xmlns:android="http://schemas.android.com/apk/res/android"
 android:shareInterpolator="false">
 <translate
 android:fromXDelta="0%" android:toXDelta="500%"
 android:fromYDelta="0%" android:toYDelta="0%"
 android:duration="700"
  android:startOffset="1000" />
 </set>

缩放

    <set xmlns:android="http://schemas.android.com/apk/res/android"
 android:interpolator="@android:anim/accelerate_interpolator">
 <rotate
 android:toDegrees="720"
 android:duration="2000"
 android:pivotX="50%"
 android:pivotY="50%"/>
 <scale
 android:fromXScale="0.1%"
 android:toXScale="100%"
 android:fromYScale="0.1%"
 android:toYScale="100%"
 android:duration="2000"  
 android:startOffset="100"/>

 </set>

1 个答案:

答案 0 :(得分:3)

问题在于%元素scale.xml文件中的scale符号。那些不是必需的,因为这些属性的值需要是float,而不是string。

<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator">
    <rotate
        android:toDegrees="720"
        android:duration="2000"
        android:pivotX="50%"
        android:pivotY="50%"/>
    <scale
        android:fromXScale="0.1"
        android:toXScale="100"
        android:fromYScale="0.1"
        android:toYScale="100"
        android:duration="2000"  
        android:startOffset="100"/>
</set>