onPostExecute on cancelled AsyncTask

前端 未结 3 1077
情歌与酒
情歌与酒 2020-12-03 00:48

Does onPostExecute execute if the AsyncTask has been cancelled?

If it does execute, is it safe to say that I should always ask if the task

3条回答
  •  长情又很酷
    2020-12-03 01:38

    After checking the AsyncTask source code it seems that onPostExecute is invoked even if the task is cancelled. However, before calling onPostExecute the result is set to null (?) if the task has been cancelled.

    Edit: @bain provides an updated answer.

提交回复
热议问题