【发布时间】:2021-01-02 06:48:41
【问题描述】:
我有两个异步任务,每个任务都在一个单独的类中,我可以在主线程中调用它们,只需使用:
new RetrieveTask().execute();
new RetrieveTaskImageData().execute();
但我希望第一个在开始第二个之前完成。
这是其中之一的示例:
class RetrieveTask extends AsyncTask<String, Void,Void> {
private Exception exception;
protected Void doInBackground(String... urls) {
try {
//Code here
} catch (Exception e) {
this.exception = e;
} finally {
}
return null;
}
protected void onPostExecute() {
//
}
}
我们怎样才能做到这一点?
编辑
我们可以使用new RetrieveTask().execute().getStatus()==..Finished 吗?
谢谢
【问题讨论】: