AsyncTask Threads由于某些原因保持打开状态(我确定他们完成了处理和退出)我不知道为什么我继续创建这种类型的更多线程,并且它们将无限期地运行.
是否有任何方式来验证这些线程是否被终止?
有什么已知的问题与AsyncTasks线程remaing打开?
运行时:
public class DonothingTask extends AsyncTask<VoID,VoID,VoID> { @OverrIDe protected VoID doInBackground(VoID... params) { // Todo auto-generated method stub return null; } }
我在debBUGer中看到一个新的线程,每次我做新的DonothingTask().execute(null);
作为愚蠢
Thread[<ThreadNumber>AsyncTask#1](running)
我的问题是为什么是这样的?我的应用程序依赖于AsyncTask,我不能有一个新的线程创建,并在每个任务后保持活着.
谢谢,
图腾
CommonsWare解释:
AsyncTask manages a thread pool,created with ThreadPoolExecutor. It will have from 5 to 128 threads. If there are more than 5 threads,those extra threads will stick around for at most 10 seconds before being removed. (note: these figures are for the presently-visible open source code and vary by AndroID release).
Leave the AsyncTask threads alone,please.
来源问题:
AsyncTask threads never die
以上是内存溢出为你收集整理的Android AsyncTask在完成后仍保持运行状态全部内容,希望文章能够帮你解决Android AsyncTask在完成后仍保持运行状态所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)