Posted By

KolNedra on 07/06/11


Tagged

android


Versions (?)

[android] setTimeout


 / Published in: Java
 

  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
Posted By: KolNedra on July 6, 2011

setTimer(1000); for a 1 second delay

You need to login to post a comment.