title: Calling a method in Custom View from a HandlerThread
body: <p>Hi all I am a beginner in android programming and I am having a little trouble trying to understand how HandlerThread works. Specifically, I am not sure if the method in the custom view class is executed in the background thread (or non-UI thread) whenever I call the method in a runnable that is added to the thread's message queue.</p>
  
  <p>I have a custom view and HandlerThread initialized in mainactivity:</p>
  
  <pre><code>HandlerThread mainHandlerThread = new HandlerThread("mainhandler");
  mainHandlerThread.start();
  Handler mainHandler = new Handler(mainHandlerThread.getLooper());
  myCustomView mcv = (MyCustomView) findViewById(R.id.customView);
  </code></pre>
  
  <p>And in MyCustomView class (which extends view), i have a method called update():</p>
  
  <pre><code>public void update(int number, String txt) {
      //perform some calculations
      invalidate(); //redraw the view
  }
  </code></pre>
  
  <p>Everytime MainActivity detects a change, it will use mainHandler.post() to call MyCustomView's update method:</p>
  
  <pre><code>mainHandler.post(new Runnable() {
      @Override
      public void run () {
          mcv.update(123,"test")
      }
  });
  </code></pre>
  
  <p>Does the above code cause the custom view to be redrawn from the HandlerThread(which is a non-UI thread)? I was able to draw the view using both <code>invalidate()</code> and <code>postInvalidate()</code>, hence I am confused on whether the <code>update()</code> method is running on the UI-thread or on the HandlerThread I created.</p>