skip to Main Content

Can anyone help?
=====================================================
I tried like this:

Animation zoom, zoom_out;


zoomAnimation();
private void zoomAnimation() {
        zoom= AnimationUtils.loadAnimation(this,R.anim.fast_zoomin);
        avatar.startAnimation(zoom);
 
        //question
        if (zoom.hasEnded()){
            zoomoutAnimation();
        }
        //question

    }

    private void zoomoutAnimation() {
        zoom_out= AnimationUtils.loadAnimation(this,R.anim.fast_zoomout);
        avatar.startAnimation(zoom_out);
    }

2

Answers


  1. Chosen as BEST ANSWER

    I made it so that when the animation started, exactly as many seconds elapsed as the animation lasted, after that another action will begin (C help of the Handler method).

    private void zoomAnimation() {
            zoom = AnimationUtils.loadAnimation(this,R.anim.fast_zoomin);
            zoom_out = AnimationUtils.loadAnimation(this,R.anim.fast_zoomout);
            avatar.startAnimation(zoom);
    
            if (!zoom.hasStarted()){
                Handler handler = new Handler();
                handler.postDelayed(new Runnable() {
                    public void run() {
                        avatar.startAnimation(zoom_out);
                    }
                }, 1500); //seconds after which another action will start when
                          //condition that the first one started
            }
    
        }
    

  2. I’m not sure I understand the question correctly.
    But I think that you need just to add a module. When the animation ends, the object still exist, so you can connect an action with an intent-filter.
    Hope to be of help

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search