Created
October 1, 2014 15:28
-
-
Save hiwanz/4407146422c7d76b255a to your computer and use it in GitHub Desktop.
An Android timer demo call
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
//need to import android.os.Handler; | |
final Handler h = new Handler(); | |
h.postDelayed(new Runnable() | |
{ | |
private long time = 0; | |
@Override | |
public void run() | |
{ | |
// do stuff then | |
// can call h again after work! | |
time += 1; | |
Log.d("TimerExample", "Going for... " + time); | |
// 1 second delay (takes millis) | |
h.postDelayed(this, 1000); | |
} | |
}, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment