开发者

AsyncTask when is onCancelled() is called besides calling AsyncTask.cancel?

Currently I have a View which has a AsyncTask class used for decoding. But eventhough AsyncTask.cancel() is not called within my class, onCancelled() has been called which resulted to some abnormal process in my 开发者_Go百科application.

I would like to ask if what are any instances that AsyncTask.onCancelled() will be called besides when calling the AsyncTask.cancel()

Any help would be appreciated. Thanks alot in advance


I think that calling the Cancel method will trigger the onCancelled event (?), in where you can write some code to cancel your task gracefully.


Hrm...

Posting .cancel() before the AsyncTask is executed means a cancel actually happens during the execution... which is obviously incorrect behaviour.

Found this our by placing all calls to .cancel(true) in my code into a single method called "cancel()" which I could then set a debug on and step out of to find the offending piece of code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜