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

  • SEARCH
  • Home
  • 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 6759349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:55:42+00:00 2026-05-26T13:55:42+00:00

I have problem with asynctask on doInBackground because I get a runtime error this

  • 0

I have problem with asynctask on doInBackground because I get a runtime error this code specifically on:

ConnectivityManager connectivity = (ConnectivityManager) content.getSystemService(Context.CONNECTIVITY_SERVICE);

((I would like to see an image in a inamgeview but first check if the connection is active these operations are performed in a separate class that does not extend activity)) :

this is the main activity:

public class TelevideoInternationalActivity extends Activity implements OnClickListener {
/** Called when the activity is first created. */

String loc = "Nazionale";
static String home_page = "http://www.televideo.rai.it/televideo/pub/tt4web/Nazionale/16_9_page-100.png";
WorkAsyncIta wai = new WorkAsyncIta();
static String but = "";
Context content;
/************DECLARES**************/
 RelativeLayout relativeLayout1;
 ImageView imgpag;
 ProgressBar probar;
/**********INITIALIZES**************/



@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    imgpag = (ImageView)findViewById (R.id.imgpag); 
    relativeLayout1 = (RelativeLayout) findViewById(R.id.RelativeLayout1);
    probar = (ProgressBar) findViewById (R.id.probar);

    wai.execute("http://www.televideo.rai.it/televideo/pub/tt4web/Nazionale/16_9_page-100.png" );


}

private class WorkAsyncIta extends AsyncTask<String, Void, Bitmap> 
{
    @Override
    protected void onPreExecute()
    {

        probar.setVisibility(0);
    }
   @Override
   protected Bitmap  doInBackground(String... url) {

         return ItaliaTelevideo.setHomePage(url[0], content);


     }
   @Override
   protected void onPostExecute(Bitmap result) {

         probar.setVisibility(1);
         imgpag.setImageBitmap(result);
         imgpag.setScaleType(ScaleType.FIT_XY);
     }  
}

}

I have corrected the error, but I see this in debug view now:

Thread [<17> AsyncTask #1] (Stepping)   
ThreadPoolExecutor$Worker.run() line: 672   
Thread.run() line: 1060 

and do not display anything on imageview then if I touch the screen returns:

Thread [<3> main] (Suspended (exception IllegalStateException))
ViewRoot.handleMessage (Message) line: 1704
ViewRoot (Handler). DispatchMessage (Message) line: 99
Looper.loop () line: 123
ActivityThread.main (String []) line: 4203
Method.invokeNative (Object, Object [], Class, Class [], Class, int, boolean) line:   not available [native method]
Method.invoke (Object, Object ...) line: 521
ZygoteInit MethodAndArgsCaller.run $ () line: 791
ZygoteInit.main (String []) line: 549
NativeStart.main (String []) line: not available [native method]
  • 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-05-26T13:55:42+00:00Added an answer on May 26, 2026 at 1:55 pm

    You cannot do any gui stuff in doInBackground(), and you are calling funciton which shows Toast message. Check documentation on AsyncTask.

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

Sidebar

Related Questions

I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have a very simple AsyncTask implementation example and am having problem in testing
In my app i have a processDialog (using AsyncTask) and at doInbackground it fetches
I have an AsyncTask which launches a DatabaseHelper class from DoinBackground which copies an
I have a very strange problem. I have an AsyncTask which appears to block
My problem is related to Android. I have the following code (non-relevant parts omitted):
I have been trying to understand and solve this problem for the last three
I have the following code: try { res = new Utils(ubc_context).new DownloadCalendarTask().execute().get(); } catch
I have problem in some JavaScript that I am writing where the Switch statement
I have problem with return statment >.< I want to store all magazine names

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.