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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:59:15+00:00 2026-05-24T12:59:15+00:00

An AsyncTask is executed on click: List<RSSItem> list = new Vector<RSSItem>(); private OnClickListener click

  • 0

An AsyncTask is executed on click:

List<RSSItem> list = new Vector<RSSItem>();
private OnClickListener click = new OnClickListener() {
    public void onClick(View view) {
        list.clear();
        if((dft.getStatus().toString()).equals("RUNNING")) dft.cancel(true);
        currentCategory = catigoriesHolder.indexOfChild(view);
        dft = new DownloadFilesTask();
        dft.execute(rssFeedURL[currentCategory]);
    }
};

In doInBackGround method the variable list is filled up. How to prevent the list to be cleared at point at which it is used to fill ListView. How to be sure, that on next click the previous instance of AsyncTask have been destroyed and there is no further processing of it.

The issue is regarding version 1.6.

  • 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-24T12:59:16+00:00Added an answer on May 24, 2026 at 12:59 pm

    First of all async task’s in general don’t run at the same moment, but the execution of the same async task is actually a queue. so imagine if you create 2 instances of your DownloadFilesTask and execute them in the same method like:

    task1.execute();
    task2.execute();
    

    this means that task 2 wont be run until task1 has finished the whole onPreExecute,DoInBg,onPostExecute process so you can be sure that that won’t happen simultaniously. also the taskStatus is an ENUM. you can check it as such not as a string like:

    task.getStatus()==Status.FINISHED
    

    in your case if you don’t want to queue multiple tasks until the currently running one is complete then do something like this:

    if(task==null || task.getStatus()!=Status.FINISHED){
        task = new DownloadFilesTask();
        task.execute();
    }
    

    Canceling a task means that the doInBackground will run but postExecute wont. you can check if the task isRunning in order to cancel it during bg processing somewhere also.

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

Sidebar

Related Questions

I am trying to execute the following AsyncTask : private class TimeUpdateTask extends AsyncTask<List<mObject>,
I have this code: private class DownloadWebPageTask extends AsyncTask<String, Void, String> { @Override protected
I have an AsyncTask which is executed just before my application quits. It gets
I have an AsyncTask that is executed before I move on to the next
I have created an asynchronous task like this: private class LongOperationcheckall extends AsyncTask<String, String,
i have an AsyncTask that gets executed when the app starts up. on a
I wanted to use AsyncTask to load images to the ListView. private class LoadImageTask
I have a method that is executed using asyncTask with a progressdialog. After this
I have an RSS feed parsed into a list view in my app. I'm
I have a list view and when item in the listview clicked, I save

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.