Posted By

arpit on 06/28/11


Tagged

android


Versions (?)

Updating the UI after an Timer interval


 / Published in: Java
 

URL: https://groups.google.com/forum/#!topic/android-developers/o0xl0Eq_af0

  1. final Handler handler = new Handler();
  2. final Runnable doUpdateView = new Runnable() {
  3. public void run() {
  4. // do something with your UI
  5. }
  6. };
  7.  
  8. TimerTask myTimerTask = new TimerTask() {
  9. public void run() {
  10. handler.post(doUpdateView);
  11. }
  12. };
  13.  
  14. Timer t = new Timer();
  15. t.scheduleAtFixedRate(myTimerTask, 0, 60000);

Report this snippet  

You need to login to post a comment.