Updating the UI from a Timer using Handler on Android

private Handler handler = new Handler();
handler.postDelayed(runnable, 100);
private Runnable runnable = new Runnable() {
   public void run() {
      /* do what you need to do */
      /* and here comes the "trick" */
      handler.postDelayed(this, 100);

If you want it to stop, you can just call handler.removeCallback(runnable) and it won’t start again, until you tell it to