But if you want to improve efficiency, I suggest using ThreadPoolExecutor. This is a sentence from developer.android.com: 线程池解决了两个不同的问题:它们通常提供 执行大量异步操作时性能提高 任务,由于减少了每个任务的调用开销,它们提供了 限制和管理资源(包括线程)的方法, 在执行任务集合时消耗.每个ThreadPoolExecutor 还维护一些基本统计信息,例如完成的数量 任务. Thread pools address two different problems: they usually provide improved performance when executing large numbers of asynchronous tasks, due to reduced per-task invocation overhead, and they provide a means of bounding and managing the resources, including threads, consumed when executing a collection of tasks. Each ThreadPoolExecutor also maintains some basic statistics, such as the number of completed tasks.总而言之,ThreadPoolExecutor可能是针对诸如您这样的情况而设计的;因此,我建议您上这堂课.In conclusion, ThreadPoolExecutor was probably designed for cases such as your; for this reason, I suggest you this class. 这篇关于AsyncTask v/s ThreadPoolExecutor用于网络请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-11 08:53