2

I started an AsyncTask. Every seems to be OK and I checked that I get to the end of the task in doInBackground. onPostExecute is called too. The problem is that I keep seeing in the list of the thread in Eclipse my AsyncTask and if I started again I see a second copy.

Shouldn't the thread be termintated at the end of onPostExecute()? I have also found this thread about the same problem.

It does not give a definitive answer though.

Thanks

Community
  • 1
  • 1
  • 3
    i can see your screen and your source code files from my home, but i am just too lazy to help you at the moment ;) Seriously, we need some of your code to help you – STT LCU Feb 13 '12 at 15:23
  • it should be finished automatically. However, we need code to see what mistake perhaps you are making – waqaslam Feb 13 '12 at 15:24
  • the reason why I did not post the code is that in the referenced question there is an example and what I'm seeing is exactly the same: 5 threads are created and left pending. After that if I create new thread they are terminated. –  Feb 13 '12 at 15:27

1 Answers1

2

Given that you haven't actually done something wrong, the presence of the Thread doesn't signal that anything is necessarily wrong. The AsyncTask uses an internal thread pool and the threads can be kept around for further future use without the overhead of Thread creation and invocations. So it's entirely possible that everything is just fine.

Brian Dupuis
  • 8,136
  • 3
  • 25
  • 29