Skip to content

Instantly share code, notes, and snippets.

@RafalSladek
Last active July 27, 2016 09:07
Show Gist options
  • Select an option

  • Save RafalSladek/09e921ac9eaa3e12ca9769294eaafeed to your computer and use it in GitHub Desktop.

Select an option

Save RafalSladek/09e921ac9eaa3e12ca9769294eaafeed to your computer and use it in GitHub Desktop.
Android Java - run code every x milliseconds, postDelayed
final Handler handler = new Handler();
Runnable run = new Runnable() {
@Override
public void run() {
// insert code to be run every 1000 milliseconds
handler.postDelayed(this, 1000);
}
};
handler.post(run);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment