Like Mark said, AsyncTasks use a pool of threads that manages itself. An AsyncTask is NOT a thread. It uses a pool of threads to execute a task on. It is based on the FutureTasks and ExecutorService of the java.util.concurrent package.
When you create a new AsyncTask, you don't create a new thread. You create a unit of work (a task) that will run on one thread chosen from a pool of threads. This pool has a fixed size and won't grow (this means that if you create tons of AsyncTasks, faster than they finish, some of these AsyncTasks will wait until a thread from the pool becomes available). On Mar 13, 12:26 pm, Gabriel Simões <gsim...@gmail.com> wrote: > Hello, > > Today, while debugging and app that uses AsyncTask to record audio and > update UI I noticed that everytime that an AsyncTask object ends > running (finishes doInBackground() and onPostExecute() or > onCancelled()) it´s thread stays alive (running status). > At least for me that should not be the behavior of the class since the > doInBackground task may not stay running forever (as an example the > android manual says that a status bar should be updated by an > asynctask, and it won´t last for the whole app running time). > > Is there anything I´m missing, as a method to destroy it, or should I > just ignore and keep creating threads as I need and the VM will handle > them as it needs resources? > > Thank you, > Gabriel Simões -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en