I want to know what is the best way to stop the async frm task.
I tried
@Override protected void onCancelled() { super.onCancelled(); mTask.cancel(true); }
I also tried
asyncTaskObject.cancel(true);
This works specifically when associated with an event.
But suppose the script --- there are 4 AsyncTask. First call the second, second calls the third and third calls the fourth. When the user enters this operation, there is no dialog box. Otherwise, we could use the onCancel method. When the user clicks anywhere on the page, a dialog box appears if the user does not click anywhere and the dialog box does not appear, but the async task runs in the background. Assume that the user presses the back button or the navigation icon to its initial position, the user.is page is out of the current activity. But the async task continues to run in the background, and ultimately the application crashes. I used the cancel method in onBackPressed. But the problem is that you cannot be sure which task is running, and add the machines again.
What is the way out of this?
android events android-asynctask
DD
source share