Created
November 13, 2014 17:20
-
-
Save johnty/b7bb118283793836da22 to your computer and use it in GitHub Desktop.
android snippet for triggering periodic events
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Handler handler = new Handler(); | |
//trigger next event. | |
handler.postDelayed(runnable, SAMPLE_INTERVAL_MS); | |
private Runnable runnable = new Runnable() { | |
//this class deals with generating periodic events, | |
// to emulate the incoming "midi messages" from device | |
// at a given rate | |
@Override | |
public void run() { | |
if (REPEAT) { //mechanism for turning on/off | |
//arm for next event | |
handler.postDelayed(runnable, SAMPLE_INTERVAL_MS); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment