使用ThreadPoolExecutor时,我可以将AsyncTask用作队列中的Runnable吗?还是这样做失败了?
//A holder for various tasks
private final LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>(5);
//Thread Pool Executor
private final ThreadPoolExecutor tpe = new ThreadPoolExecutor(3, 3, 10, TimeUnit.SECONDS, queue);
最佳答案
AsyncTask不是Runnable,因此您不能真正使用它。
关于java - 使用ThreadPoolExecutor和AsyncTask,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/2251806/