0

我有一个名为 computeStrokes 的函数,我需要使用不同的参数调用它两次。Asynctask 中有一个名为executeOnExecutor的方法,它允许 asynctask 并行运行两个线程。我无法理解如何在AsyncTask 的doInBackground方法。有人可以帮我处理本节的代码吗,即doInBackground

4

1 回答 1

0

如果您确实需要从 AsyncTask 并行运行 2 个任务,那么您可以在 doInBackground 中启动 2 个任务并在那里等待两者完成。这可以在Executors and a Future的帮助下实现

于 2012-11-01T08:34:39.047 回答