I have called asynctask.cancel(true) in a button click after the async task starts.i am checking for iscancelled value in doinbackground and wrote condition accordingly.the conditions is
while(myProgress<phnno.size()){
                if (isCancelled()) {
                    break;
                }else{
                     myProgress++;
                        publishProgress();
                           SystemClock.sleep(100);
                }
               }
But still the asynchronous task is not cancelled.Could anyone give suggestions regarding this. Thanks in advance
 
     
    