Are there any real performance implications of Handlers vs Threads?
<p>There have been a number of questions regarding the proper usage of <code>Threads</code> vs. <code>Handlers</code> vs. <code>AsyncTask</code>. (like <a href="http://stackoverflow.com/questions/6964011/handler-vs-asynctask-vs-thread">here</a> &amp; <a href="http://stackoverflow.com/questions/3102203/handler-vs-thread">here</a>) </p>

<p>Those questions nicely addressed the question of when to use what. My question is more about the performance implications in certain types of cases. </p>

<p>As an example, I often see other people write code in which they use <code>Threads</code> simply to be able to schedule some code execution for the future. Whenever, I see this, I instinctively feel like refactoring the code to use a <code>Handler</code> and just a post a delayed <code>runnable</code>.</p>

<p>Here's an example where a Thread is used to update the seekbar for some media playing with a <code>mediaplayer</code> and then the way I would do it. </p>

<p><strong>what I see a lot:</strong></p>

<pre><code> if (positionTracker != null &amp;&amp; positionTracker.isAlive()
                &amp;&amp; !positionTracker.isInterrupted()) {
            return;
        }

        positionTracker = new Thread(new Runnable() {

            public void run() {
                int currentPosition = 0;
                int total = player.getDuration();
                while (player != null &amp;&amp; CurrentPosition &lt; total) {
                    try {
                        Thread.sleep(1000);
                        currentPosition = player.getCurrentPosition();
                    } catch (InterruptedException e) {
                        return;
                    } catch (Exception e) {
                        return;
                    }


                    if (someListener != null) {
                        someListener.onEvent();
                    }

                }
            }

        }, "position tracker thread");

        positionTracker.start();
</code></pre>

<p><strong>And the way I like to do it:</strong></p>

<pre><code>Runnable trackPositionRunnable = new Runnable() {
            @Override
            public void run() {
                currentPosition = player.getCurrentPosition();
                if (someListener != null) {
                    someListener.onEvent();
                    mHandler.postDelayed(this, 1000);
                }
            }
        };

        mHandler.post(trackPositionRunnable);
</code></pre>

<p>Obviously, my preferred way is a bit easier to read and more concise. <strong>But what are the performance implications? Is one way method better, in terms of performance, than the other? If so, why?</strong></p>
