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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:38:28+00:00 2026-05-24T01:38:28+00:00

I am learning Android via a book and would just like to confirm something.

  • 0

I am learning Android via a book and would just like to confirm something.

When using AsyncTask according to the book it goes something like this:

main class
{
 new AddStringTask().execute(); 
  } 

  class AddStringTask extends AsyncTask<Void, String, Void> { 
@Override 
protected Void doInBackground(Void... unused) { 
  // Do something
    SystemClock.sleep(333);
      return(something); 
    } 
 @Override 
    protected void onProgressUpdate(String... item) { 
        // update something

} 
      } 

which creates one background thread to do some stuff.
So if I want more threads, for example firing at different times (300, 500, 1000 milliseconds) then I need
to make even more sub classes… true?

Or is there some way to do multiple threads firing at different times using just this one subclass?

Thanks!

  • 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-24T01:38:29+00:00Added an answer on May 24, 2026 at 1:38 am

    then I need to make even more sub classes… true?

    Not true.

    You can just execute the same AsyncTask again by creating a new AddStringTask() instance. This works since it’ll be a new instance which differs from the other ones and each instance has its own thread. They are not interdependent.

    However, the timer mechanism is something you have to implement yourself.

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

Sidebar

Related Questions

I'm learning android now, and i write some simple codes according to the book.
I'm learning the Android api from a book, and it seems like there isn't
Am a noob learning Android via a book and for threading I see there
I am a noob learning Android via a book, i have a quick question.
I am a learning via a book so please forgive this newbie question. I
I am learning this via Sams Teach Yourself Android in 24 hours. This is
this is my first post.. so I'm learning Android & Java (coming from Actionscript),
I'm familiar with C++ but never used Java. I've just started learning Android development.
When i started learning android i learned that R.java files goes to /gen folder
I'm learning Android development using Pro Android Web Apps (Apress, Auths: Damon Oehlman &

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.