android - onCancelled() is called, but isCancelled() is never called -


i making http request using asynctask , want when logout, asynctask should stop. calling cancel(true) in onstop(). when call cancel(true), requests not started yet, cancelled, problem iscancelled() never called checks if executing task cancelled or not. checking iscancelled() in doinbackgroud() method of asynctask there way stop executing asynctask. following scenario.

class asyncclass extends asynctask<>{      @override      protected string doinbackground(void... params)       {              if(iscancelled())                {                 log.d("iscancelled", iscancelled());                }           //call webservice        }     } 

now there other class i'm calling

if(asynctaskobject!=null){     asynctaskobject.cancel(true);         asynctaskobject=null; } 

but log statement inside iscancelled() never called.

why expect iscancelled() should executed android itself. getter method allows code query status of task.


Comments

Popular posts from this blog

Glib GIOChannel -

delphi - When I encode/decode SMS PDU (GSM 7 Bit) user data, do I need prepend the UDH first? -

python - Obscure curses error message when creating a sub window -