AsyncTask Cancel is not working

后端 未结 4 773
庸人自扰
庸人自扰 2021-01-20 02:46

I am learning how to cancel asyncTask so there is no uses on the code below.

I tried to called the asyncTask and execute it then cancel it and execute it.



        
4条回答
  •  青春惊慌失措
    2021-01-20 03:47

    you should not call asyncTask.onCancelled(); directly. You can call cancel(true) and inside your doInBackground() you check for isCancelled().

提交回复
热议问题