I am running an animation in my Android app using the following code:
RelativeLayout layout = (RelativeLayout) findViewById(R.id.relativeLayout1);
layout.setBackgroundResource(R.drawable.translate);
final TransitionDrawable transition = (TransitionDrawable) layout.getBackground();
transition.startTransition(9000);
The animation runs for 9 seconds, and then it needs to be reversed.
At the moment I am using a countdown timer (already one running in the app), to check if 9 seconds has gone by and manually reverse the transition….
Is there a better way to do this?
Thanks
To answer my own question, no there is no onCompletionListener. Instead you do have to manually count the seconds and then reverse the transision.
I also asked this question during an Android Developer Hangout with Google, and it could not be answered in any other way.