动画不断崩溃在三星Galaxy [英] Animation keeps crashing on a samsung galaxy

查看:162
本文介绍了动画不断崩溃在三星Galaxy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

林有一个问题是我的程序总是崩溃上的动画我试图做的。它工作正常,在我的Razr手机的版本4.1.2,但在银河系它与 NumberFormatException异常有版本2.3.6崩溃。

谁能告诉我这是为什么崩溃?我仍然试图找出如果这是一个SDK版本问题。我也试过在三星S3安装我签署.apk文件,它甚至不会安装。这给了我一个空白屏幕。这似乎只与三星手机的问题。

 公共类RSEanimation延伸活动{    @覆盖
    保护无效的onCreate(捆绑savedInstanceState){
        super.onCreate(savedInstanceState);
        super.setContentView(R.layout.startup);
        最后ImageView的animationTarget1 =(ImageView的)this.findViewById(R.id.rseImage);
        最终的TextView animationTarget2 =(TextView中)this.findViewById(R.id.textView1);
        最终的TextView animationTarget3 =(TextView中)this.findViewById(R.id.textView2);
        最终的TextView animationTarget4 =(TextView中)this.findViewById(R.id.textView3);
        动画动画= AnimationUtils.loadAnimation(这一点,R.anim.scale);
        最终的动画动画1 = AnimationUtils.loadAnimation(这一点,R.anim.left_to_right);
        最终的动画animation2 = AnimationUtils.loadAnimation(这一点,R.anim.left_to_right);
        最终的动画动画3 = AnimationUtils.loadAnimation(这一点,R.anim.left_to_right);
        最终的动画animation4 = AnimationUtils.loadAnimation(这一点,R.anim.right_to_left);
        animationTarget1.startAnimation(动画);
        animationTarget4.setVisibility(View.VISIBLE);
        animationTarget4.startAnimation(动画1);        animation1.setAnimationListener(新AnimationListener(){
            @覆盖
            公共无效onAnimationStart(动画动画){}
            @覆盖
            公共无效onAnimationRepeat(动画动画){}
            @覆盖
            公共无效onAnimationEnd(动画动画){
                animationTarget3.setVisibility(View.VISIBLE);
                animationTarget3.startAnimation(animation2);
            }
        });
        animation2.setAnimationListener(新AnimationListener(){
            @覆盖
            公共无效onAnimationStart(动画动画){}
            @覆盖
            公共无效onAnimationRepeat(动画动画){}
            @覆盖
            公共无效onAnimationEnd(动画动画){
                animationTarget2.setVisibility(View.VISIBLE);
                animationTarget2.startAnimation(动画3);
            }
        });
        animation3.setAnimationListener(新AnimationListener(){
            @覆盖
            公共无效onAnimationStart(动画动画){}            @覆盖
            公共无效onAnimationRepeat(动画动画){
            }
            @覆盖
            公共无效onAnimationEnd(动画动画){
                animationTarget1.startAnimation(animation4);
                animationTarget2.startAnimation(animation4);
                animationTarget3.startAnimation(animation4);
                animationTarget4.startAnimation(animation4);
            }
        });
        animation4.setAnimationListener(新AnimationListener(){
            @覆盖
            公共无效onAnimationStart(动画动画){}            @覆盖
            公共无效onAnimationRepeat(动画动画){
            }            @覆盖
            公共无效onAnimationEnd(动画动画){
                animationTarget1.setVisibility(View.INVISIBLE);
                animationTarget2.setVisibility(View.INVISIBLE);
                animationTarget3.setVisibility(View.INVISIBLE);
                animationTarget4.setVisibility(View.INVISIBLE);
                 RSEanimation.this.startActivity(新意图(RSEanimation.this,RiverConditionsActivity.class));            }
        });
       }     @覆盖
        公共无效onRestart(){
              super.onRestart();
                  完();
     }
    }

logcat的:

  06-22 19:53:41.164:W /的ResourceType(5374):输入标识0x12c比条目计数0xac较大
06-22 19:53:41.187:W /资源(5374):转换为float:{的TypedValue T =为0x6 / D = 0x20c530一个= -1}
06-22 19:53:41.187:W / dalvikvm(5374):主题ID = 1:螺纹未捕获的异常(组= 0x40015578)退出
06-22 19:53:41.195:E / AndroidRuntime(5374):致命异常:主要
06-22 19:53:41.195:E / AndroidRuntime(5374):了java.lang.RuntimeException:无法启动活动ComponentInfo {com.rse.jamesriver / com.rse.jamesriver.RSEanimation}:java.lang.NumberFormatException
06-22 19:53:41.195:E / AndroidRuntime(5374):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
06-22 19:53:41.195:E / AndroidRuntime(5374):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
06-22 19:53:41.195:E / AndroidRuntime(5374):在android.app.ActivityThread.access $ 1500(ActivityThread.java:117)
06-22 19:53:41.195:E / AndroidRuntime(5374):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:935)
06-22 19:53:41.195:E / AndroidRuntime(5374):在android.os.Handler.dispatchMessage(Handler.java:99)
06-22 19:53:41.195:E / AndroidRuntime(5374):在android.os.Looper.loop(Looper.java:130)
06-22 19:53:41.195:E / AndroidRuntime(5374):在android.app.ActivityThread.main(ActivityThread.java:3687)
06-22 19:53:41.195:E / AndroidRuntime(5374):在java.lang.reflect.Method.invokeNative(本机方法)
06-22 19:53:41.195:E / AndroidRuntime(5374):在java.lang.reflect.Method.invoke(Method.java:507)
06-22 19:53:41.195:E / AndroidRuntime(5374):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:842)
06-22 19:53:41.195:E / AndroidRuntime(5374):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
06-22 19:53:41.195:E / AndroidRuntime(5374):在dalvik.system.NativeStart.main(本机方法)
06-22 19:53:41.195:E / AndroidRuntime(5374):因:java.lang.NumberFormatException
06-22 19:53:41.195:E / AndroidRuntime(5374):在org.apache.harmony.luni.util.FloatingPointParser.parseFltImpl(本机方法)
06-22 19:53:41.195:E / AndroidRuntime(5374):在org.apache.harmony.luni.util.FloatingPointParser.parseFloat(FloatingPointParser.java:321)
06-22 19:53:41.195:E / AndroidRuntime(5374):在java.lang.Float.parseFloat(Float.java:323)
06-22 19:53:41.195:E / AndroidRuntime(5374):在android.content.res.TypedArray.getFloat(TypedArray.java:287)
06-22 19:53:41.195:E / AndroidRuntime(5374):在06-22 19:53:41.195:E / AndroidRuntime(5374):在android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:110)
06-22 19:53:41.195:E / AndroidRuntime(5374):在android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:106)
06-22 19:53:41.195:E / AndroidRuntime(5374):在android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:83)
06-22 19:53:41.195:E / AndroidRuntime(5374):在android.view.animation.AnimationUtils.loadAnimation(AnimationUtils.java:64)
06-22 19:53:41.195:E / AndroidRuntime(5374):在com.rse.jamesriver.RSEanimation.onCreate(RSEanimation.java:25)
06-22 19:53:41.195:E / AndroidRuntime(5374):在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-22 19:53:41.195:E / AndroidRuntime(5374):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)

LEFT_TO_RIGHT

 <设置的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
 机器人:shareInterpolator =假>
 <翻译Android:fromXDelta = - 200%机器人:toXDelta =0%
         机器人:fromYDelta =0%安卓toYDelta =0%
         机器人:时间=500
         机器人:startOffset =100/>
  < /集>

RIGHT_TO_LEFT

 <设置的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
 机器人:shareInterpolator =假>
 <翻译
 机器人:fromXDelta =0%安卓toXDelta =500%
 机器人:fromYDelta =0%安卓toYDelta =0%
 机器人:时间=700
  机器人:startOffset =1000/>
 < /集>

缩放

 <设置的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
 机器人:插值=@机器人:动画/ accelerate_interpolator>
 <旋转
 机器人:toDegrees =720
 机器人:时间=2000
 机器人:pivotX =50%
 机器人:pivotY =50%/>
 <规模
 机器人:fromXScale =0.1%
 机器人:toXScale =100%
 机器人:fromYScale =0.1%
 机器人:toYScale =100%
 机器人:时间=2000
 机器人:startOffset =100/> < /集>


解决方案

您的问题是在 scale.xml 迹象code>文件的比例元素。因为这些属性的值必须是浮动,不串那些不是必需的。

 <设置的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
机器人:插值=@机器人:动画/ accelerate_interpolator>
    <旋转
        机器人:toDegrees =720
        机器人:时间=2000
        机器人:pivotX =50%
        机器人:pivotY =50%/>
    <规模
        机器人:fromXScale =0.1
        机器人:toXScale =100
        机器人:fromYScale =0.1
        机器人:toYScale =100
        机器人:时间=2000
        机器人:startOffset =100/>
< /集>

Im having a issue were my app keeps crashing on an animation I'm attempting to do. It works fine on my Razr version 4.1.2 but on the galaxy it crashes with a NumberFormatException it has version 2.3.6.

Can anyone tell my why this is crashing? I am still trying to figure out if this is a sdk version issue. Also I tried to install my signed .apk on a samsung S3 and it wont even install. It just gives me a blank screen. This seems to only be an issue with Samsung phones.

    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>

Scale

    <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>

解决方案

Your problem is with the % signs in the scale.xml file for the scale element. Those are not required as the value of those attributes needs to be float, not 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>

这篇关于动画不断崩溃在三星Galaxy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆