1

I have written an animation like progressdialog . I want to stop and hide animation when click the button. Here is my codes.

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);


    img = (ImageView)findViewById(R.id.imageView1);

    startButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
             img.setBackgroundResource(R.drawable.animitems);
             myAnim = (AnimationDrawable)img.getBackground();
             if(videoView.isPlaying()){
                 videoView.pause();
                 myAnim.stop();
                 myAnim.setVisible(false, true);
                 startButton.setBackgroundResource(R.drawable.andplaybtn);
             }else{
                 startButton.setBackgroundResource(R.drawable.andstopbtn);
                 myAnim.start();
                 videoView.start();
             }
        }
    });

You see that I have used DrawableAnimation class. But I can't hide animation when is started. How to do this? Thanks for your helps.

emreturka
  • 846
  • 3
  • 18
  • 44

0 Answers0