Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Putting a Listener on the transition animation between activities

In android, is it possible to put a listener on the animation you get between activities, so that code can be executed at the end of the animation?

like image 200
Paul Boddington Avatar asked Aug 27 '14 21:08

Paul Boddington


1 Answers

Try this

Transition transition = getWindow().getSharedElementEnterTransition();
transition.addTarget(android.R.transition.slide_top);
transition.addListener(new Transition.TransitionListener() {

    @Override
    public void onTransitionStart(Transition transition) {
        Log.e("transition ","onTransitionStart");
    }

    @Override
    public void onTransitionEnd(Transition transition) {
        Log.e("transition ","onTransitionEnd");
    }

    @Override
    public void onTransitionCancel(Transition transition) {

    }

    @Override
    public void onTransitionPause(Transition transition) {

    }

    @Override
    public void onTransitionResume(Transition transition) {

    }
});
like image 78
Arman Chatikyan Avatar answered Oct 21 '22 01:10

Arman Chatikyan