如何多次执行异步任务?

How to execute the asynchronous task several times?

我想根据列表的大小多次执行异步任务。如何实现?我也想每次都改参数..

您可以遍历列表大小并在其中调用异步任务。

for(int i=0; i<list.size();i++)
{
     // Call AsyncTask with any value you want to pass
     // just generate a constructor accordingly

     new AsyncTask(i).execute();  
}

并使用所需的构造函数获取 AsyncTask class 中的值:

 public class AsyncTask{

        Integer position;
        public AsyncTask(Integer passedValue)
        {
            position = passedValue;
        }
    }

希望对你有帮助ツ