While working on an application I noticed that the thread count keeps growing all the time. AsyncTask threads remain open for some reason (I'm sure they finished processing and exited). I have no idea why I keep creating more threads of this type and they keep running indefinitely.
Is there any way to verify that these threads are terminated on completion? Are there any known issues with AsyncTask threads remaining open?
When running this:
public class DoNothingTask extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
// TODO Auto-generated method stub
return null;
}
}
I see in the debbuger a new thread for each time I do new DoNothingTask().execute(null);
as follows:
Thread[<ThreadNumber>AsyncTask#1](running)
My question is why is this? My application relies a lot on AsyncTask and I can't have a new thread created and stay alive after each task.