How to make animation with drawble animation

51 views Asked by At

I would like to play 2 animationdrawables after eachother..

When the first one stops, the other one has to start..(using OnTouchListener)

The problem is:

AnimationListener is not possible with animationdrawables

Does anybody know a solution?

thank you

1

There are 1 answers

1
swastika pallai On

sorry for late answer, but I even faced this same problem when i was making an application in android. I don't know this would work, but I used a countdown timer. In my situation i had a button, which when clicked, will start a animation and when the animation finishes, it will start another function. so for that, i used a countdown timer inside the setOnclickListener (for the button). Here's an example:)

start.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
   
    throwing.setImageResource(R.drawable.throwing);
    AnimationDrawable idleAnimation = (AnimationDrawable) throwing.getDrawable();
        idleAnimation.start();

        new CountDownTimer(680, 3000) {

            public void onTick(long millisUntilFinished) {

            }

            public void onFinish() {
                //place your code here which you want to execute when the first animation finishes.
            }

        }.start();
});