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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:44:46+00:00 2026-06-12T07:44:46+00:00

My application contains a long loop which calculates many values within my UIThread and

  • 0

My application contains a long loop which calculates many values within my UIThread and subsequently draws them onscreen.

If I were to offload the calculation loop onto a separate thread using AsyncTask, I would be unable to run MyAsyncTask.execute() multiple times as according to the documentation: “The task can be executed only once”. When I attempted to run the code I was able to see a single frame drawn but then an exception was thrown: “Cannot execute the task: the task has already been executed (a task can be executed only once)”.

It would not be a good idea to create a new AsyncTask object during each iteration of the draw loop, so is there any way to reuse the same AsyncTask object to run MyAsyncTask.execute() again? Or if not, what would be a more appropriate method to use? Can other forms of threads achieve this?

  • 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-12T07:44:47+00:00Added an answer on June 12, 2026 at 7:44 am

    Create AsyncTask class object each time when you want to excute.

    Example

        Task _task=new Task();
        _task.excute();
    

    For More Info Read This Tutorial Link

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

Sidebar

Related Questions

My application contains a bug, which makes script run infinitelly long. When I force
I am developing an ASP.Net VB Web Application The application contains a GridView which
I have an application that contains many controls on a panel, each with its
I am developing an application that contains 2 themes and pictures which i use
I long variable in vb.net which contains the following information, Dim g As String
I have a WPF application in which i have to do a long running
I have my main application, which contains several instances of a component that create
APPLICATION and ENVIRONMENT Java EE / JSF2.0 / JPA enterprise application, which contains a
Suppose I have a very long file, utilities.php, which contains most if not all
My RCP application contains 5 views which fill contents via database queries. The problem

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.