title: Android Timer: postDelayed vs. schedule
body: <p>I need stuff to be done every 200 milliseconds and I need it to be smooth and even. The task to do is medium-weight(in both cases, of the question 1 and 2).
  Searching for timers look like the best solution from the community is to use an handler, a runnable and <code>postDelayed()</code>, ( <a href="https://stackoverflow.com/questions/4597690/android-timer-how/4598737#4598737">How to set timer in android?</a> ).</p>
  <p><em><strong>Updated Questions:</strong></em></p>
  <p>-Which way is most precise and fast if I have to interact with the UI, <code>postDelayed()</code> or <code>schedule()/scheduleAtFixedRate()</code>?</p>
  <p>-Which way is most precise and fast if I don't have to interact with the UI, <code>postDelayed()</code> or <code>schedule()/scheduleAtFixedRate()</code>?</p>
  <p>-Both ways could be executed on the main process or on a separate one? how?</p>
  <p>This way I have the mainclass local objects, but is it a new thread? Is it a good practice?</p>
  <pre><code>timer.schedule( new TimerTask() {           
          @Override
          public void run() {
                      textview.setText(str);
                      //other stuff            
                                       }
              }, 0, 200);
  </code></pre>
  <p>The next is another with schedule, the task is in a separate task, not the timer itself, I guess, and I can't interact with the UI directly, I guess...</p>
  <pre><code>timer.schedule( new aclass(), 0, 200);
  </code></pre>
  <p>Handler way(from Dave.B):</p>
  <pre><code>Handler timerHandler = new Handler();
  Runnable timerRunnable = new Runnable() {
      @Override
      public void run() {
          TextView.setText(str);
          // other stuff
          timerHandler.postDelayed(this, 500); }
  };
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
  ...
  timerHandler.postDelayed(timerRunnable, 0);
  }
  </code></pre>