Skip to content

Instantly share code, notes, and snippets.

@angusholder
Created October 15, 2022 23:32
Show Gist options
  • Save angusholder/944a34d942cc367d52c785ca63181530 to your computer and use it in GitHub Desktop.
Save angusholder/944a34d942cc367d52c785ca63181530 to your computer and use it in GitHub Desktop.
private final Handler uiHandler = new Handler(Looper.getMainLooper());
private void startAnimation() {
animateBallRestart(firstBall);
uiHandler.postDelayed(new Runnable() {
@Override
public void run() {
animateBallRestart(secondBall);
uiHandler.postDelayed(new Runnable() {
@Override
public void run() {
animateBallRestart(thirdBall);
}
}, Constants.ANIMATION_DELAY_MILLIS);
}
}, Constants.ANIMATION_DELAY_MILLIS);
}
@Override
public void onDestroyView() {
super.onDestroyView();
// Cancels any currently queued calls to Handler.postDelayed
uiHandler.removeCallbacksAndMessages(null);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment