Handler or runOnUiThread solution for "Can't create handler inside thread that has not called Looper.prepare() "
<p>Recently, I show up a toast in user thread and got the above runtime error.</p>

<p>From <a href="http://stackoverflow.com/questions/3875184/cant-create-handler-inside-thread-that-has-not-called-looper-prepare">Can&#39;t create handler inside thread that has not called Looper.prepare()</a>, they proposed use <code>Handler</code> as solution. However, I saw the solution is quite lengthy and cumbersome.</p>

<p>My own solution is to use <code>runOnUiThread</code></p>

<pre><code>private void showTooDarkToastMessage()
{
    ((Activity) this.getContext()).runOnUiThread(new Runnable() {
        @Override
        public void run() {
            Toast toast = Toast.makeText(getContext(), getResources().getString(R.string.toast_toodark), Toast.LENGTH_LONG);
            toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
            toast.show();
        }
    });        
}
</code></pre>

<p>I was wondering, is there any shortcoming of using <code>runOnUiThread</code>, compared to <code>Handler</code>?</p>
