Skip to content

Instantly share code, notes, and snippets.

@ABeltramo
Created August 1, 2015 16:29
Show Gist options
  • Select an option

  • Save ABeltramo/5a59d60c7978d96bd1a9 to your computer and use it in GitHub Desktop.

Select an option

Save ABeltramo/5a59d60c7978d96bd1a9 to your computer and use it in GitHub Desktop.
Timer groundTimer = new Timer(); //Istanzio un ground timer
private Runnable runnable = new Runnable(){
public void run() {
groundTimer.tick(); //Eseguo la tick del timer
}
};
//Avvio l'esecuzione del runnable ogni secondo
private final int interval = 1000; // 1 Second
private Handler handler = new Handler();
handler.postAtTime(runnable, System.currentTimeMillis()+interval);
handler.postDelayed(runnable, interval);
//Creo l'engine
Engine eng = new Engine(groundTimer);
//...
//Aggiungo i vari timer aggiuntivi
//...
eng.start(); //Avvio l'esecuzione
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment