Error when running new Drawable Animation on Android Stuido

1

I have a problem. I created a test animation for a Splash Screen from a project of mine. It works fine. Now when I made a new animation to replace this old one, the application stops at nothing.

Animation 1 = > animation.xml, animation_01.png, animation_02.png, ... animation_06.png.

Correspondingxml=>

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/animation_01" android:duration="500"></item>
    <item android:drawable="@drawable/animation_02" android:duration="500"></item>
    <item android:drawable="@drawable/animation_03" android:duration="500"></item>
    <item android:drawable="@drawable/animation_04" android:duration="500"></item>
    <item android:drawable="@drawable/animation_05" android:duration="500"></item>
    <item android:drawable="@drawable/animation_06" android:duration="600"></item>

</animation-list>

Animation 02 = > an.xml, an01.png, an02.png, ... an18.png.

Correspondingxml=>

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/an01" android:duration="150"></item>
    <item android:drawable="@drawable/an02" android:duration="150"></item>
    <item android:drawable="@drawable/an03" android:duration="150"></item>
    <item android:drawable="@drawable/an04" android:duration="150"></item>
    <item android:drawable="@drawable/an05" android:duration="150"></item>
    <item android:drawable="@drawable/an06" android:duration="150"></item>
    <item android:drawable="@drawable/an07" android:duration="150"></item>
    <item android:drawable="@drawable/an08" android:duration="150"></item>
    <item android:drawable="@drawable/an09" android:duration="150"></item>
    <item android:drawable="@drawable/an10" android:duration="150"></item>
    <item android:drawable="@drawable/an11" android:duration="150"></item>
    <item android:drawable="@drawable/an12" android:duration="150"></item>
    <item android:drawable="@drawable/an13" android:duration="150"></item>
    <item android:drawable="@drawable/an14" android:duration="150"></item>
    <item android:drawable="@drawable/an15" android:duration="150"></item>
    <item android:drawable="@drawable/an16" android:duration="150"></item>
    <item android:drawable="@drawable/an17" android:duration="150"></item>
    <item android:drawable="@drawable/an18" android:duration="500"></item>

</animation-list>

Here is the SplashScreen activity code with the first animation that works.

package genesysgeneration.crushhelper;

import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;

public class SplashScreenActivity extends AppCompatActivity {

    private ImageView ivInvisible;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash_screen);

        Thread myThread = new Thread(){

            @Override

            public void run(){

                try {

                    sleep(3000);
                    Intent it = new Intent(getApplicationContext(), MainMenuActivity.class);
                    startActivity(it);
                    finish();

                } catch (InterruptedException e) {

                    e.printStackTrace();

                }

            }

        };

        myThread.start();

        ivInvisible=(ImageView)findViewById(R.id.ivInvisible);
        ivInvisible.setBackgroundResource(R.drawable.animation);

        AnimationDrawable animation_01 = (AnimationDrawable)ivInvisible.getBackground();
        animation_01.start();

    }

}

To change animation I change the line ivInvisible.setBackgroundResource(R.drawable.animation); to ivInvisible.setBackgroundResource(R.drawable.an); . No error is accused, however when I run in the android virtual machine the application stops at nothing.

    
asked by anonymous 15.03.2017 / 23:45

0 answers