Putting the listener in the transition animation between actions

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

+4
source share
2 answers

try it

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) {

    }
});
+2
source

Make a post post in 1 second in onCreate (). The duration of an activity animation is the same length, regardless of what it does (new Handler ()). PostDelayed (Runnable) should do the trick by simply adjusting the delay.

0
source

All Articles