Android: got CalledFromWrongThreadException in onPostExecute() - How could it be?
<p>I have an app in production for a few weeks, using ACRA, and I had zero errors until one strange error reported today.</p>

<p>I've got:</p>

<pre><code>    android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
</code></pre>

<p>coming from this method in the stack trace (retraced):</p>

<pre><code>at my.app.CountdownFragment$1.void onPostExecute(java.lang.Object)(SourceFile:1)
</code></pre>

<p>And this is the relevant source snippet:</p>

<pre><code>    private void addInstructionsIfNeeded() {
    if (S.sDisplayAssist) {
        new AsyncTask&lt;String, Void, String&gt;() {

            @Override
            protected String doInBackground(String... params) {
                return null;
            }

            /*
             * runs on the ui thread
             */
            protected void onPostExecute(String result) {

                Activity a = getActivity();

                if (S.sHelpEnabled &amp;&amp; a != null) {

                    in = new InstructionsView(a.getApplicationContext());

                    RelativeLayout mv = (RelativeLayout) a
                            .findViewById(R.id.main_place);

                    mv.addView(in.prepareView());
                }

            };

        }.execute("");
    }
}
</code></pre>

<p>Where <code>addInstructionsIfNeeded()</code> is called from a handler dispatched message (the UI thead). </p>

<ul>
<li><code>onPostExecute()</code> runs on the UI thread, so why I've got "wrong thread"?</li>
<li>This code ran already on more than 150 devices, and more than 100000 times (according to Flurry), and never had this error.</li>
<li>The originating device is Samsung SGH-I997 running SDK 4.0.4</li>
</ul>

<p>My question is: How could it be?</p>

<p><strong>EDIT</strong>:
This all happens in a fragment</p>
