[android] setTimeout


/ Published in: Java
Save to your folder(s)



Copy this code and paste it in your HTML
  1. protected Handler taskHandler = new Handler();
  2. protected void setTimer( long time ) {
  3. Runnable t = new Runnable() {
  4. public void run() {
  5. runNextTask();
  6. }
  7. };
  8. taskHandler.postAtTime(t, SystemClock.uptimeMillis() + time);
  9. }
  10.  
  11. protected void runNextTask() {
  12. // timer finished
  13. };

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.