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 6077533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:43:54+00:00 2026-05-23T10:43:54+00:00

Consider this: I’ve got Activity, in onCreate() I start AsyncTask to load its content.

  • 0

Consider this: I’ve got Activity, in onCreate() I start AsyncTask to load its content. I’ve followed this sample. Now my problem is: I want to download file in that Activity, using AsyncTask. But I don’t know how to make existing AsyncTask do various tasks.
If anyone had the same problem, I would appreciate your help.

  • 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-23T10:43:55+00:00Added an answer on May 23, 2026 at 10:43 am

    Well, I’ve succeeded to make it call again and again… you have to instantiate your class as a null first (int the Activity).

    MyAsyncTask asyncTask = null;
    

    and then put it in a try… catch block:

    asyncTask = (MyAsyncTask) new MyAsyncTask().execute(params);
    

    The other thing you’re interrested about is the differenc methods you want to run… Well, I wanted to do the same, but I’ve had no time writing that one, but I’ve thought about it on the way home from work.

    I think your class extending AsyncTask should look like this:

    class MyAsyncTask extends AsyncTask<Object, Object, Object> { }
    

    create some variables or ArrayLists in your AsyncTask, and do the decision on the overriden onPreExecute() method where you have to make a switch, or some if’s. Do the call/work on the overriden doInBackground(), get the result, and process it in the overriden onPostExecute() method.

    I don’t know if this line works, since I’ve had no time to experiment it, I really just thought about it, how to… 🙂

    But I hope the thought helps at least! 🙂

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

Sidebar

Related Questions

Consider this problem: I have a program which should fetch (let's say) 100 records
Consider this sample code: <div class=containter id=ControlGroupDiv> <input onbeforeupdate=alert('bingo 0'); return false; onclick=alert('click 0');return
Consider this code: TimeStamp.Text = BlogComment.Date.UtcNow.ToString(yyyy-MM-ddTHH\:mm\:ss.fffffffzzz); BlogComment.Date is a DateTime object with its date
Consider this code: #include <iostream> using namespace std; typedef int array[12]; array sample; array
Consider this function template: template<typename T> unsigned long f(void *) { return 0;} Now,
Consider this code... using System.Threading; //... Timer someWork = new Timer( delegate(object state) {
Consider this case: dll = LoadDLL() dll->do() ... void do() { char *a =
Consider this Python program which uses PyGtk and Hippo Canvas to display a clickable
Consider this: public class TestClass { private String a; private String b; public TestClass()
consider this code block public void ManageInstalledComponentsUpdate() { IUpdateView view = new UpdaterForm(); BackgroundWorker

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.