Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8110875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:54:50+00:00 2026-06-06T01:54:50+00:00

Can anybody tell me why my Async task fails sometimes like this? I tested

  • 0

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);

            }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T01:54:52+00:00Added an answer on June 6, 2026 at 1:54 am

    You are trying to do UI-related work (manipulating Views) on the background thread. setBackgroundDrawable() and setBackgroundResource() are methods of the View class, not ASyncTask.

    You can’t do this. Have a look at runOnUiThread() as a way of instigating UI updates from a background thread in the general case.

    But for an ASyncTask specifically, there are already convenient hooks for you to do stuff on the UI thread. You should think about overriding onProgressUpdate() and onPostExecute(), and doing your UI work in there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can anybody tell me why this works <g:each var=n in=${com.pp.News.list()}> <h2>${n.t}</h2> <p>${n.tx}</p> </g:each> but
can anybody tell me the reason why I m getting this error: conversion to
Can anybody tell me which View Switcher Control is this in below image.?
Can anybody tell me how to search for available iPhone/iPod devices on a network
can anybody tell me what's the point if any for a javascript function like
Can anybody tell me how to make this C code work in C++ please?
Can anybody tell me how can I implement something like the Stack Overflow tags
Can anybody tell me why this doesn't work as expected? <?php $merchant_string = '123-Reg|Woolovers|Roxio|Roxio|BandQ|Roxio|Roxio|Big
Can anybody tell me why a lot of Ruby boolean methods use this double
Can anybody tell me how to fix this query? update ae44 set Price =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.