Can anybody tell me why my Async task fails sometimes like this?
I tested it on 3 devices but this error never occured for me.
I uploaded to GooglePlay and after **200 downloads** there are **3 error** reports with this thing, i dont know yet what the main source of the error... 

```
java.lang.RuntimeException: An error occured while executing doInBackground()
    at android.os.AsyncTask$3.done(AsyncTask.java:200)
    at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:125)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
    at java.lang.Thread.run(Thread.java:1019)
    Caused by: android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
    at android.view.ViewRoot.checkThread(ViewRoot.java:3225)
    at android.view.ViewRoot.invalidateChild(ViewRoot.java:760)
    at android.view.ViewRoot.invalidateChildInParent(ViewRoot.java:786)
    at android.view.ViewGroup.invalidateChild(ViewGroup.java:2511)
    at android.view.View.invalidate(View.java:5498)
    at android.view.View.setBackgroundDrawable(View.java:7845)
    at android.view.View.setBackgroundResource(View.java:7754)
    at com.KeySoft.NewPilates.Activities.LatestActivity.parseXml(LatestActivity.java:1106)
    at com.KeySoft.NewPilates.Activities.LatestActivity.access$1(LatestActivity.java:964)
    at com.KeySoft.NewPilates.Activities.LatestActivity$DownloadXml.doInBackground(LatestActivity.java:354)
    at com.KeySoft.NewPilates.Activities.LatestActivity$DownloadXml.doInBackground(LatestActivity.java:1)
    at android.os.AsyncTask$2.call(AsyncTask.java:185)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)

```

I see that my **AsyncTaks's** \**doInBackground*\* function there is a **setBackgroundDrawable** and **setBacktroundResource** func that do someting not verry well... any ideas?

E D I T:

Got solution from the checked answer:

I must use a new Runnable to modify the views inside from doInBackround.

```
runOnUiThread(new Runnable() {
             public void run() {

                 LinearLayout hatterLayout = (LinearLayout)findViewById(R.id.hatterLayout);
                hatterLayout.setBackgroundResource(R.drawable.nonet);

            }

```