I have found many answers to cancel an AsyncTask, to set object.cancel(true) and in do in background method check
for (int i = 0; i < appState.getAvailableText().length;i++){
if(isCancelled()){
break;
}
//Do your updating stuff here
}
But in my Asynctask there is no for loops or switch cases ,hw can i Stop or Cancel the AsyncTYask background process by clicking a button???