0
    AnimationDrawable animation = new AnimationDrawable();
    animation.addFrame(getResources().getDrawable(R.drawable.a1), 1000);
    animation.addFrame(getResources().getDrawable(R.drawable.a2), 1000);
    animation.addFrame(getResources().getDrawable(R.drawable.a3), 1000);
    animation.addFrame(getResources().getDrawable(R.drawable.a4), 1000);
    animation.addFrame(getResources().getDrawable(R.drawable.a5), 1000);
    animation.addFrame(getResources().getDrawable(R.drawable.a6), 1000);
    animation.addFrame(getResources().getDrawable(R.drawable.a7), 1000);
    animation.addFrame(getResources().getDrawable(R.drawable.a8), 1000);
    animation.addFrame(getResources().getDrawable(R.drawable.a9), 1000);
    animation.addFrame(getResources().getDrawable(R.drawable.a10), 1000);
    animation.setOneShot(true);

    sayac = (ImageView) findViewById(R.id.sayac);
    sayac.setImageDrawable(animation);

    animation.start();


     // play the animation when i push the play button
     play.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

        }
    });

    // pause the animation when i push pause button...
    pause.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

        }
    });

I want to pause and resume AnimationDrawable. But I can't. How can I do this?

Or can I do the same animation with ObjectAnimator or others?

If I can do the same animation with ObjectAnimator how can I do this? Is there any lesson or example?

altocumulus
  • 21,179
  • 13
  • 61
  • 84

0 Answers0