Updating the UI after an Timer interval


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



Copy this code and paste it in your HTML
  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);

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.